[PATCH] simplify and fix /proc/net/unix parsing

Michael Meeks michael.meeks at suse.com
Wed Jan 11 04:31:40 PST 2012


---
 src/tmpfiles.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/tmpfiles.c b/src/tmpfiles.c
index 19a7c08..65da6fb 100644
--- a/src/tmpfiles.c
+++ b/src/tmpfiles.c
@@ -135,15 +135,8 @@ static void load_unix_sockets(void) {
 
                 truncate_nl(line);
 
-                if (strlen(line) < 53)
-                        continue;
-
-                p = line + 53;
-                p += strspn(p, WHITESPACE);
-                p += strcspn(p, WHITESPACE);
-                p += strspn(p, WHITESPACE);
-
-                if (*p != '/')
+                /* the numeric fields are followed by an absolute path beginning with '/' */
+                if (line[0] == '\0' || !(p = strchr (line, '/')))
                         continue;
 
                 if (!(s = strdup(p)))
-- 
1.7.3.4


--=-yZ765u2Nk30qbXPuEQVZ--



More information about the systemd-devel mailing list