]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib: use ul_prefix for close_all_fds() and mkdir_p()
authorKarel Zak <kzak@redhat.com>
Thu, 28 Jan 2021 09:27:21 +0000 (10:27 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 28 Jan 2021 09:27:21 +0000 (10:27 +0100)
The names are too generic and it makes problems in static libraries.

Addresses: https://gitlab.com/cryptsetup/cryptsetup/-/issues/623
Signed-off-by: Karel Zak <kzak@redhat.com>
include/fileutils.h
lib/fileutils.c
libmount/src/context.c
libmount/src/utils.c
login-utils/login.c

index 7047ac5ccb1d572db03195c9fa22419086006bd4..10fe46a25db012e00577f9b9f5e305f31db2c953 100644 (file)
@@ -55,7 +55,7 @@ static inline int is_same_inode(const int fd, const struct stat *st)
 extern int dup_fd_cloexec(int oldfd, int lowfd);
 extern unsigned int get_fd_tabsize(void);
 
-extern int mkdir_p(const char *path, mode_t mode);
+extern int ul_mkdir_p(const char *path, mode_t mode);
 extern char *stripoff_last_component(char *path);
 
 /* This is readdir()-like function, but skips "." and ".." directory entries */
@@ -87,7 +87,7 @@ static inline int close_range(unsigned int first, unsigned int last)
 #endif /* __linux__ */
 
 #ifndef HAVE_CLOSE_RANGE
-extern void close_all_fds(unsigned int first, unsigned int last);
+extern void ul_close_all_fds(unsigned int first, unsigned int last);
 #endif
 
 #define UL_COPY_READ_ERROR (-1)
index a9cb33581241eecd28ff6f973ed4385f460a13cd..846b718c9bb46cdf1172df3793c8cb82a04d3db8 100644 (file)
@@ -130,7 +130,7 @@ unsigned int get_fd_tabsize(void)
 }
 
 #ifndef HAVE_CLOSE_RANGE
-void close_all_fds(unsigned int first, unsigned int last)
+void ul_close_all_fds(unsigned int first, unsigned int last)
 {
        struct dirent *d;
        DIR *dir;
@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
 # ifdef HAVE_CLOSE_RANGE
                close_range(STDERR_FILENO + 1, ~0U);
 # else
-               close_all_fds(STDERR_FILENO + 1, ~0U);
+               ul_close_all_fds(STDERR_FILENO + 1, ~0U);
 # endif
        } else if (strcmp(argv[1], "--copy-file") == 0) {
                int ret = ul_copy_file(STDIN_FILENO, STDOUT_FILENO);
@@ -205,7 +205,7 @@ int main(int argc, char *argv[])
 #endif
 
 
-int mkdir_p(const char *path, mode_t mode)
+int ul_mkdir_p(const char *path, mode_t mode)
 {
        char *p, *dir;
        int rc = 0;
index 19a8cb1a621cbe4a14dd7f52fa254982427197db..fa8a8c54b56b0e1a5fd98dbd36953a93e58d1f7c 100644 (file)
@@ -1956,7 +1956,7 @@ int mnt_context_prepare_target(struct libmnt_context *cxt)
 
                /* supported only for root or non-suid mount(8) */
                if (!mnt_context_is_restricted(cxt)) {
-                       rc = mkdir_p(tgt, mode);
+                       rc = ul_mkdir_p(tgt, mode);
                        if (rc)
                                DBG(CXT, ul_debug("mkdir %s failed: %m", tgt));
                } else
index aed2afb81fb18a6428f15651f73954bdc701c4bc..35afce32c086fcb83318919afc499e5fc67040a5 100644 (file)
@@ -1311,7 +1311,7 @@ static int test_mkdir(struct libmnt_test *ts, int argc, char *argv[])
 {
        int rc;
 
-       rc = mkdir_p(argv[1], S_IRWXU |
+       rc = ul_mkdir_p(argv[1], S_IRWXU |
                         S_IRGRP | S_IXGRP |
                         S_IROTH | S_IXOTH);
        if (rc)
index 4f71925dbd48aeb618d3b5db8ae27d7b715e1446..552e9c1d5a2a92a17f2de7ee93ec95c07ccb8478 100644 (file)
@@ -1365,7 +1365,7 @@ static void initialize(int argc, char **argv, struct login_context *cxt)
 #ifdef HAVE_CLOSE_RANGE
        close_range(STDERR_FILENO + 1, ~0U);
 #else
-       close_all_fds(STDERR_FILENO + 1, ~0U);
+       ul_close_all_fds(STDERR_FILENO + 1, ~0U);
 #endif
 }