|
a/src/utils/smallut.cpp |
|
b/src/utils/smallut.cpp |
|
... |
|
... |
995 |
dip->m2 = d2.m1;
|
995 |
dip->m2 = d2.m1;
|
996 |
dip->d2 = d2.d1;
|
996 |
dip->d2 = d2.d1;
|
997 |
return true;
|
997 |
return true;
|
998 |
}
|
998 |
}
|
999 |
|
999 |
|
|
|
1000 |
|
|
|
1001 |
void catstrerror(string *reason, const char *what, int _errno)
|
|
|
1002 |
{
|
|
|
1003 |
if (!reason)
|
|
|
1004 |
return;
|
|
|
1005 |
if (what)
|
|
|
1006 |
reason->append(what);
|
|
|
1007 |
|
|
|
1008 |
reason->append(": errno: ");
|
|
|
1009 |
|
|
|
1010 |
char nbuf[20];
|
|
|
1011 |
sprintf(nbuf, "%d", _errno);
|
|
|
1012 |
reason->append(nbuf);
|
|
|
1013 |
|
|
|
1014 |
reason->append(" : ");
|
|
|
1015 |
|
|
|
1016 |
#ifdef sun
|
|
|
1017 |
// Note: sun strerror is noted mt-safe ??
|
|
|
1018 |
reason->append(strerror(_errno));
|
|
|
1019 |
#else
|
|
|
1020 |
#define ERRBUFSZ 200
|
|
|
1021 |
char errbuf[ERRBUFSZ];
|
|
|
1022 |
// There are 2 versions of strerror_r.
|
|
|
1023 |
// - The GNU one returns a pointer to the message (maybe
|
|
|
1024 |
// static storage or supplied buffer).
|
|
|
1025 |
// - The POSIX one always stores in supplied buffer and
|
|
|
1026 |
// returns 0 on success. As the possibility of error and
|
|
|
1027 |
// error code are not specified, we're basically doomed
|
|
|
1028 |
// cause we can't use a test on the 0 value to know if we
|
|
|
1029 |
// were returned a pointer...
|
|
|
1030 |
// Also couldn't find an easy way to disable the gnu version without
|
|
|
1031 |
// changing the cxxflags globally, so forget it. Recent gnu lib versions
|
|
|
1032 |
// normally default to the posix version.
|
|
|
1033 |
// At worse we get no message at all here.
|
|
|
1034 |
errbuf[0] = 0;
|
|
|
1035 |
strerror_r(_errno, errbuf, ERRBUFSZ);
|
|
|
1036 |
reason->append(errbuf);
|
|
|
1037 |
#endif
|
|
|
1038 |
}
|
|
|
1039 |
|
|
|
1040 |
|
1000 |
#else
|
1041 |
#else
|
1001 |
|
1042 |
|
1002 |
#include <string>
|
1043 |
#include <string>
|
1003 |
using namespace std;
|
1044 |
using namespace std;
|
1004 |
#include <iostream>
|
1045 |
#include <iostream>
|