]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "basic: add fallback in chase_symlinks_and_opendir() for cases when /proc...
authorLennart Poettering <lennart@poettering.net>
Fri, 2 Dec 2022 16:53:27 +0000 (17:53 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 2 Dec 2022 16:57:10 +0000 (17:57 +0100)
This reverts commit 3e22dfc2352bb5c4f058e23a82f424655b599b18.

src/basic/chase-symlinks.c

index 118a6ee68f8e2e0521a983813d2f471e4b8d4543..0bb07000bad8922b10e83a4793cb6bd059997df0 100644 (file)
@@ -552,22 +552,14 @@ int chase_symlinks_and_opendir(
                 return 0;
         }
 
-        r = chase_symlinks(path, root, chase_flags, &p, &path_fd);
+        r = chase_symlinks(path, root, chase_flags, ret_path ? &p : NULL, &path_fd);
         if (r < 0)
                 return r;
         assert(path_fd >= 0);
 
         d = opendir(FORMAT_PROC_FD_PATH(path_fd));
-        if (!d) {
-                /* Hmm, we have the fd already but we got ENOENT, most likely /proc is not mounted.
-                 * Let's try opendir() again on the full path. */
-                if (errno == ENOENT) {
-                        d = opendir(p);
-                        if (!d)
-                                return -errno;
-                } else
-                        return -errno;
-        }
+        if (!d)
+                return -errno;
 
         if (ret_path)
                 *ret_path = TAKE_PTR(p);