]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Minor simplification in sockaddr_un_set_path() 16947/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 9 Sep 2020 21:57:59 +0000 (23:57 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 9 Sep 2020 22:46:44 +0000 (00:46 +0200)
src/basic/socket-util.c

index 85edc83cae341770460243c4cfc664de6ed56888..7a3299672abc8b968e8082f1e300364063119e1f 100644 (file)
@@ -1118,12 +1118,10 @@ int sockaddr_un_set_path(struct sockaddr_un *ret, const char *path) {
          * reference paths in the abstract namespace that include NUL bytes in the name. */
 
         l = strlen(path);
-        if (l == 0)
+        if (l < 2)
                 return -EINVAL;
         if (!IN_SET(path[0], '/', '@'))
                 return -EINVAL;
-        if (path[1] == 0)
-                return -EINVAL;
 
         /* Don't allow paths larger than the space in sockaddr_un. Note that we are a tiny bit more restrictive than
          * the kernel is: we insist on NUL termination (both for abstract namespace and regular file system socket