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