chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Drop FOREACH_WORD_QUOTED
[elogind.git]
/
src
/
basic
/
process-util.c
diff --git
a/src/basic/process-util.c
b/src/basic/process-util.c
index 5bf0a180bea7f1b2fedf6dbd73d52f23e9541ddc..359c3a4e4e00dfd015c2802ffd1e1e37ff227704 100644
(file)
--- a/
src/basic/process-util.c
+++ b/
src/basic/process-util.c
@@
-195,7
+195,7
@@
int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
*(k++) = (char) c;
left--;
*(k++) = (char) c;
left--;
- }
else if (k > r)
+ } else if (k > r)
space = true;
}
space = true;
}
@@
-235,14
+235,14
@@
int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
return h;
if (max_length == 0)
return h;
if (max_length == 0)
- r = strjoin("[", t, "]"
, NULL
);
+ r = strjoin("[", t, "]");
else {
size_t l;
l = strlen(t);
if (l + 3 <= max_length)
else {
size_t l;
l = strlen(t);
if (l + 3 <= max_length)
- r = strjoin("[", t, "]"
, NULL
);
+ r = strjoin("[", t, "]");
else if (max_length <= 6) {
r = new(char, max_length);
else if (max_length <= 6) {
r = new(char, max_length);
@@
-262,7
+262,7
@@
int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
e--;
*e = 0;
e--;
*e = 0;
- r = strjoin("[", t, "...]"
, NULL
);
+ r = strjoin("[", t, "...]");
}
}
if (!r)
}
}
if (!r)
@@
-558,7
+558,7
@@
int wait_for_terminate(pid_t pid, siginfo_t *status) {
if (errno == EINTR)
continue;
if (errno == EINTR)
continue;
- return
-errno
;
+ return
negative_errno()
;
}
return 0;
}
return 0;
@@
-631,8
+631,10
@@
int kill_and_sigcont(pid_t pid, int sig) {
r = kill(pid, sig) < 0 ? -errno : 0;
r = kill(pid, sig) < 0 ? -errno : 0;
- if (r >= 0)
- kill(pid, SIGCONT);
+ /* If this worked, also send SIGCONT, unless we already just sent a SIGCONT, or SIGKILL was sent which isn't
+ * affected by a process being suspended anyway. */
+ if (r >= 0 && !IN_SET(SIGCONT, SIGKILL))
+ (void) kill(pid, SIGCONT);
return r;
}
return r;
}
@@
-812,7
+814,7
@@
void valgrind_summary_hack(void) {
#ifdef HAVE_VALGRIND_VALGRIND_H
if (getpid() == 1 && RUNNING_ON_VALGRIND) {
pid_t pid;
#ifdef HAVE_VALGRIND_VALGRIND_H
if (getpid() == 1 && RUNNING_ON_VALGRIND) {
pid_t pid;
- pid = raw_clone(SIGCHLD
, NULL
);
+ pid = raw_clone(SIGCHLD);
if (pid < 0)
log_emergency_errno(errno, "Failed to fork off valgrind helper: %m");
else if (pid == 0)
if (pid < 0)
log_emergency_errno(errno, "Failed to fork off valgrind helper: %m");
else if (pid == 0)