chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hostnamectl: should the sanitized arch, not the native uname() one
[elogind.git]
/
src
/
core
/
unit.c
diff --git
a/src/core/unit.c
b/src/core/unit.c
index 27d3be3860af7b46bc950ce52e88a7c07f7bbb82..a59556d97c52b8dd90f17845b4470132738f0e16 100644
(file)
--- a/
src/core/unit.c
+++ b/
src/core/unit.c
@@
-959,7
+959,7
@@
static int unit_add_target_dependencies(Unit *u) {
Unit *target;
Iterator i;
unsigned k;
Unit *target;
Iterator i;
unsigned k;
- int r;
+ int r
= 0
;
assert(u);
assert(u);
@@
-1140,8
+1140,6
@@
_pure_ static const char *unit_get_status_message_format_try_harder(Unit *u, Job
return NULL;
}
return NULL;
}
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void unit_status_print_starting_stopping(Unit *u, JobType t) {
const char *format;
static void unit_status_print_starting_stopping(Unit *u, JobType t) {
const char *format;
@@
-1154,12
+1152,11
@@
static void unit_status_print_starting_stopping(Unit *u, JobType t) {
if (!format)
return;
if (!format)
return;
+ DISABLE_WARNING_FORMAT_NONLITERAL;
unit_status_printf(u, "", format);
unit_status_printf(u, "", format);
+ REENABLE_WARNING;
}
}
-#pragma GCC diagnostic pop
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
const char *format;
char buf[LINE_MAX];
static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
const char *format;
char buf[LINE_MAX];
@@
-1179,8
+1176,10
@@
static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
if (!format)
return;
if (!format)
return;
+ DISABLE_WARNING_FORMAT_NONLITERAL;
snprintf(buf, sizeof(buf), format, unit_description(u));
char_array_0(buf);
snprintf(buf, sizeof(buf), format, unit_description(u));
char_array_0(buf);
+ REENABLE_WARNING;
mid = t == JOB_START ? SD_MESSAGE_UNIT_STARTING :
t == JOB_STOP ? SD_MESSAGE_UNIT_STOPPING :
mid = t == JOB_START ? SD_MESSAGE_UNIT_STARTING :
t == JOB_STOP ? SD_MESSAGE_UNIT_STOPPING :
@@
-1192,7
+1191,6
@@
static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
"MESSAGE=%s", buf,
NULL);
}
"MESSAGE=%s", buf,
NULL);
}
-#pragma GCC diagnostic pop
/* Errors:
* -EBADR: This unit type does not support starting.
/* Errors:
* -EBADR: This unit type does not support starting.
@@
-1833,7
+1831,7
@@
void unit_tidy_watch_pids(Unit *u, pid_t except1, pid_t except2) {
if (pid == except1 || pid == except2)
continue;
if (pid == except1 || pid == except2)
continue;
- if (
kill(pid, 0) < 0 && errno == ESRCH
)
+ if (
!pid_is_unwaited(pid)
)
set_remove(u->pids, e);
}
}
set_remove(u->pids, e);
}
}
@@
-2525,12
+2523,11
@@
int unit_coldplug(Unit *u) {
return 0;
}
return 0;
}
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) {
void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) {
+ DISABLE_WARNING_FORMAT_NONLITERAL;
manager_status_printf(u->manager, false, status, unit_status_msg_format, unit_description(u));
manager_status_printf(u->manager, false, status, unit_status_msg_format, unit_description(u));
+ REENABLE_WARNING;
}
}
-#pragma GCC diagnostic pop
bool unit_need_daemon_reload(Unit *u) {
_cleanup_strv_free_ char **t = NULL;
bool unit_need_daemon_reload(Unit *u) {
_cleanup_strv_free_ char **t = NULL;
@@
-2860,7
+2857,6
@@
static int drop_in_file(Unit *u, UnitSetPropertiesMode mode, const char *name, c
assert(name);
assert(_p);
assert(_q);
assert(name);
assert(_p);
assert(_q);
- assert(mode & (UNIT_PERSISTENT|UNIT_RUNTIME));
b = xescape(name, "/.");
if (!b)
b = xescape(name, "/.");
if (!b)
@@
-2879,7
+2875,7
@@
static int drop_in_file(Unit *u, UnitSetPropertiesMode mode, const char *name, c
return -ENOENT;
p = strjoin(c, "/", u->id, ".d", NULL);
return -ENOENT;
p = strjoin(c, "/", u->id, ".d", NULL);
- } else if (mode
& UNIT_PERSISTENT
)
+ } else if (mode
== UNIT_PERSISTENT && !u->transient
)
p = strjoin("/etc/systemd/system/", u->id, ".d", NULL);
else
p = strjoin("/run/systemd/system/", u->id, ".d", NULL);
p = strjoin("/etc/systemd/system/", u->id, ".d", NULL);
else
p = strjoin("/run/systemd/system/", u->id, ".d", NULL);
@@
-2905,7
+2901,7
@@
int unit_write_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name, co
assert(name);
assert(data);
assert(name);
assert(data);
- if (!
(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)
))
+ if (!
IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME
))
return 0;
r = drop_in_file(u, mode, name, &p, &q);
return 0;
r = drop_in_file(u, mode, name, &p, &q);
@@
-2925,7
+2921,7
@@
int unit_write_drop_in_format(Unit *u, UnitSetPropertiesMode mode, const char *n
assert(name);
assert(format);
assert(name);
assert(format);
- if (!
(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)
))
+ if (!
IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME
))
return 0;
va_start(ap, format);
return 0;
va_start(ap, format);
@@
-2948,7
+2944,7
@@
int unit_write_drop_in_private(Unit *u, UnitSetPropertiesMode mode, const char *
if (!UNIT_VTABLE(u)->private_section)
return -EINVAL;
if (!UNIT_VTABLE(u)->private_section)
return -EINVAL;
- if (!
(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)
))
+ if (!
IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME
))
return 0;
ndata = strjoin("[", UNIT_VTABLE(u)->private_section, "]\n", data, NULL);
return 0;
ndata = strjoin("[", UNIT_VTABLE(u)->private_section, "]\n", data, NULL);
@@
-2967,7
+2963,7
@@
int unit_write_drop_in_private_format(Unit *u, UnitSetPropertiesMode mode, const
assert(name);
assert(format);
assert(name);
assert(format);
- if (!
(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)
))
+ if (!
IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME
))
return 0;
va_start(ap, format);
return 0;
va_start(ap, format);
@@
-2986,7
+2982,7
@@
int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name) {
assert(u);
assert(u);
- if (!
(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)
))
+ if (!
IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME
))
return 0;
r = drop_in_file(u, mode, name, &p, &q);
return 0;
r = drop_in_file(u, mode, name, &p, &q);