ac3a84
From eb9135c9499f6be627323929df48bc9efc93926a Mon Sep 17 00:00:00 2001
ac3a84
From: Frantisek Sumsal <fsumsal@redhat.com>
ac3a84
Date: Thu, 8 Dec 2022 10:56:42 +0100
ac3a84
Subject: [PATCH] Revert "basic: add fallback in chase_symlinks_and_opendir()
ac3a84
 for cases when /proc is not mounted"
ac3a84
ac3a84
This reverts commit 47c0c5108b39d01283ba040c41d556b160d45a55.
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 src/basic/chase-symlinks.c | 14 +++-----------
ac3a84
 1 file changed, 3 insertions(+), 11 deletions(-)
ac3a84
ac3a84
diff --git a/src/basic/chase-symlinks.c b/src/basic/chase-symlinks.c
ac3a84
index c09aab389e..afab54f067 100644
ac3a84
--- a/src/basic/chase-symlinks.c
ac3a84
+++ b/src/basic/chase-symlinks.c
ac3a84
@@ -466,22 +466,14 @@ int chase_symlinks_and_opendir(
ac3a84
                 return 0;
ac3a84
         }
ac3a84
 
ac3a84
-        r = chase_symlinks(path, root, chase_flags, &p, &path_fd);
ac3a84
+        r = chase_symlinks(path, root, chase_flags, ret_path ? &p : NULL, &path_fd);
ac3a84
         if (r < 0)
ac3a84
                 return r;
ac3a84
         assert(path_fd >= 0);
ac3a84
 
ac3a84
         d = opendir(FORMAT_PROC_FD_PATH(path_fd));
ac3a84
-        if (!d) {
ac3a84
-                /* Hmm, we have the fd already but we got ENOENT, most likely /proc is not mounted.
ac3a84
-                 * Let's try opendir() again on the full path. */
ac3a84
-                if (errno == ENOENT) {
ac3a84
-                        d = opendir(p);
ac3a84
-                        if (!d)
ac3a84
-                                return -errno;
ac3a84
-                } else
ac3a84
-                        return -errno;
ac3a84
-        }
ac3a84
+        if (!d)
ac3a84
+                return -errno;
ac3a84
 
ac3a84
         if (ret_path)
ac3a84
                 *ret_path = TAKE_PTR(p);