#include "common/errno.h"
#include "acconfig.h"
+#include "include/compat.h"
#include <sstream>
#include <string.h>
if (err < 0)
err = -err;
std::ostringstream oss;
- buf[0] = '\0';
- // strerror_r returns char * on Linux, and does not always fill buf
-#ifdef STRERROR_R_CHAR_P
- errmsg = strerror_r(err, buf, sizeof(buf));
-#else
- strerror_r(err, buf, sizeof(buf));
- errmsg = buf;
-#endif
+ errmsg = ceph_strerror_r(err, buf, sizeof(buf));
oss << "(" << err << ") " << errmsg;
*/
#include "acconfig.h"
+#include "include/compat.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
if (status < 0) {
char error_buf[80];
-#ifdef STRERROR_R_CHAR_P
- char* dummy = strerror_r(errno, error_buf, sizeof(error_buf));
- (void)dummy;
-#else
- strerror_r(errno, error_buf, sizeof(error_buf));
-#endif
+ char* errp = ceph_strerror_r(errno, error_buf, sizeof(error_buf));
fprintf(stderr, "couldn't run '%s': %s\n", command,
- error_buf);
+ errp);
} else if (WIFSIGNALED(status)) {
fprintf(stderr, "'%s' killed by signal %d\n", command,
WTERMSIG(status));
#include <fcntl.h>
#include <keyutils.h>
+#include "include/compat.h"
#include "common/armor.h"
#include "common/safe_io.h"
if (ret < 0) {
char error_buf[80];
fprintf(stderr, "secret is not valid base64: %s.\n",
- strerror_r(-ret, error_buf, sizeof(error_buf)));
+ ceph_strerror_r(-ret, error_buf, sizeof(error_buf)));
return ret;
}
} else {
char error_buf[80];
fprintf(stderr, "adding ceph secret key to kernel failed: %s.\n",
- strerror_r(-ret, error_buf, sizeof(error_buf)));
+ ceph_strerror_r(-ret, error_buf, sizeof(error_buf)));
return ret;
}
}