]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/dropin: ignore ENAMETOOLONG when checking drop-in directories (#7525)
authorLukáš Nykrýn <lnykryn@redhat.com>
Fri, 1 Dec 2017 19:34:49 +0000 (20:34 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 1 Dec 2017 19:34:49 +0000 (20:34 +0100)
This usually happens for device units with long
path in /sys. But users can't even create such drop-ins,
so lets just ignore the error here.

Fixes #6867

src/shared/dropin.c

index a16f436bede7e41a1938510a23f6be2a3a6d0385..f0966874eeeaafe92682e275f33beeb209c26526 100644 (file)
@@ -128,7 +128,11 @@ static int unit_file_find_dir(
         assert(path);
 
         r = chase_symlinks(path, original_root, 0, &chased);
-        if (r == -ENOENT) /* Ignore -ENOENT, after all most units won't have a drop-in dir */
+        /* Ignore -ENOENT, after all most units won't have a drop-in dir.
+         * Also ignore -ENAMETOOLONG, users are not even able to create
+         * the drop-in dir in such case. This mostly happens for device units with long /sys path.
+         * */
+        if (IN_SET(r, -ENOENT, -ENAMETOOLONG))
                 return 0;
         if (r < 0)
                 return log_full_errno(LOG_WARNING, r, "Failed to canonicalize path %s: %m", path);