chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pam: fix build
[elogind.git]
/
src
/
tmpfiles.c
diff --git
a/src/tmpfiles.c
b/src/tmpfiles.c
index 19a7c08c40550fe72fbe62897fac445bc27794a0..44e5c9d28d01788fcb738cc4ac7b07bc92f5e3ad 100644
(file)
--- a/
src/tmpfiles.c
+++ b/
src/tmpfiles.c
@@
-117,41
+117,50
@@
static void load_unix_sockets(void) {
/* We maintain a cache of the sockets we found in
* /proc/net/unix to speed things up a little. */
/* We maintain a cache of the sockets we found in
* /proc/net/unix to speed things up a little. */
- if (!(unix_sockets = set_new(string_hash_func, string_compare_func)))
+ unix_sockets = set_new(string_hash_func, string_compare_func);
+ if (!unix_sockets)
return;
return;
- if (!(f = fopen("/proc/net/unix", "re")))
+ f = fopen("/proc/net/unix", "re");
+ if (!f)
return;
return;
- if (!(fgets(line, sizeof(line), f)))
+ /* Skip header */
+ if (!fgets(line, sizeof(line), f))
goto fail;
for (;;) {
char *p, *s;
int k;
goto fail;
for (;;) {
char *p, *s;
int k;
- if (!
(fgets(line, sizeof(line), f)
))
+ if (!
fgets(line, sizeof(line), f
))
break;
truncate_nl(line);
break;
truncate_nl(line);
- if (strlen(line) < 53)
+ p = strchr(line, ':');
+ if (!p)
+ continue;
+
+ if (strlen(p) < 37)
continue;
continue;
- p
= line + 53
;
+ p
+= 37
;
p += strspn(p, WHITESPACE);
p += strspn(p, WHITESPACE);
- p += strcspn(p, WHITESPACE);
+ p += strcspn(p, WHITESPACE);
/* skip one more word */
p += strspn(p, WHITESPACE);
if (*p != '/')
continue;
p += strspn(p, WHITESPACE);
if (*p != '/')
continue;
- if (!(s = strdup(p)))
+ s = strdup(p);
+ if (!s)
goto fail;
path_kill_slashes(s);
goto fail;
path_kill_slashes(s);
- if ((k = set_put(unix_sockets, s)) < 0) {
+ k = set_put(unix_sockets, s);
+ if (k < 0) {
free(s);
if (k != -EEXIST)
free(s);
if (k != -EEXIST)
@@
-1059,7
+1068,8
@@
int main(int argc, char *argv[]) {
Item *i;
Iterator iterator;
Item *i;
Iterator iterator;
- if ((r = parse_argv(argc, argv)) <= 0)
+ r = parse_argv(argc, argv);
+ if (r <= 0)
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
log_set_target(LOG_TARGET_AUTO);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
log_set_target(LOG_TARGET_AUTO);