chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
manager: configurable StartLimit default values
[elogind.git]
/
src
/
core
/
killall.c
diff --git
a/src/core/killall.c
b/src/core/killall.c
index e078012c1b9cc7d3ef9da23d30b6fea12e395075..e3950501075e736230eb3fd970faff65f17b9283 100644
(file)
--- a/
src/core/killall.c
+++ b/
src/core/killall.c
@@
-32,9
+32,8
@@
#define TIMEOUT_USEC (10 * USEC_PER_SEC)
static bool ignore_proc(pid_t pid) {
#define TIMEOUT_USEC (10 * USEC_PER_SEC)
static bool ignore_proc(pid_t pid) {
- char buf[PATH_MAX];
- FILE *f;
- char c;
+ _cleanup_fclose_ FILE *f = NULL;
+ char c, *p;
size_t count;
uid_t uid;
int r;
size_t count;
uid_t uid;
int r;
@@
-51,15
+50,12
@@
static bool ignore_proc(pid_t pid) {
if (uid != 0)
return false;
if (uid != 0)
return false;
- snprintf(buf, sizeof(buf), "/proc/%lu/cmdline", (unsigned long) pid);
- char_array_0(buf);
-
- f = fopen(buf, "re");
+ p = procfs_file_alloca(pid, "cmdline");
+ f = fopen(p, "re");
if (!f)
return true; /* not really, but has the desired effect */
count = fread(&c, 1, 1, f);
if (!f)
return true; /* not really, but has the desired effect */
count = fread(&c, 1, 1, f);
- fclose(f);
/* Kernel threads have an empty cmdline */
if (count <= 0)
/* Kernel threads have an empty cmdline */
if (count <= 0)