tree-wide: introduce strerror_safe()
This commit is contained in:
+1
-1
@@ -4891,7 +4891,7 @@ static void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
|
||||
cmd = exec_command_line(c->argv);
|
||||
fprintf(f,
|
||||
"%sCommand Line: %s\n",
|
||||
prefix, cmd ? cmd : strerror(ENOMEM));
|
||||
prefix, cmd ? cmd : strerror_safe(ENOMEM));
|
||||
|
||||
exec_status_dump(&c->exec_status, f, prefix2);
|
||||
}
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) {
|
||||
break;
|
||||
}
|
||||
|
||||
r = log_warning_errno(errno, "Failed to add watch on %s: %s", s->path, errno == ENOSPC ? "too many watches" : strerror(-r));
|
||||
r = log_warning_errno(errno, "Failed to add watch on %s: %s", s->path, errno == ENOSPC ? "too many watches" : strerror_safe(r));
|
||||
if (cut)
|
||||
*cut = tmp;
|
||||
goto fail;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "audit-fd.h"
|
||||
#include "bus-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "format-util.h"
|
||||
#include "log.h"
|
||||
#include "path-util.h"
|
||||
@@ -158,7 +159,7 @@ static int access_init(sd_bus_error *error) {
|
||||
/* Return an access denied error, if we couldn't load
|
||||
* the AVC but enforcing mode was on, or we couldn't
|
||||
* determine whether it is one. */
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Failed to open the SELinux AVC: %s", strerror(saved_errno));
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Failed to open the SELinux AVC: %s", strerror_safe(saved_errno));
|
||||
}
|
||||
|
||||
selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback) audit_callback);
|
||||
|
||||
+1
-1
@@ -782,7 +782,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
|
||||
r = socket_address_print(&p->address, &k);
|
||||
if (r < 0)
|
||||
t = strerror(-r);
|
||||
t = strerror_safe(r);
|
||||
else
|
||||
t = k;
|
||||
|
||||
|
||||
+1
-1
@@ -1326,7 +1326,7 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
"%s\tMerged into: %s\n",
|
||||
prefix, u->merged_into->id);
|
||||
else if (u->load_state == UNIT_ERROR)
|
||||
fprintf(f, "%s\tLoad Error Code: %s\n", prefix, strerror(-u->load_error));
|
||||
fprintf(f, "%s\tLoad Error Code: %s\n", prefix, strerror_safe(u->load_error));
|
||||
|
||||
for (n = sd_bus_track_first(u->bus_track); n; n = sd_bus_track_next(u->bus_track))
|
||||
fprintf(f, "%s\tBus Ref: %s\n", prefix, n);
|
||||
|
||||
Reference in New Issue
Block a user