]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libuuid: use get_fd_tabsize()
authorKarel Zak <kzak@redhat.com>
Mon, 23 Apr 2012 12:00:18 +0000 (14:00 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 23 Apr 2012 12:00:18 +0000 (14:00 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libuuid/src/Makefile.am
libuuid/src/gen_uuid.c

index 8e872100bb489edcbb3f1760dfaece5be8e30295..1df282ede59cca35c79ef14912f08ae878bf6d1d 100644 (file)
@@ -26,6 +26,7 @@ libuuid_la_SOURCES = \
        uuidP.h \
        uuid_time.c \
        $(uuidinc_HEADERS) \
+       $(top_srcdir)/lib/fileutils.c \
        $(top_srcdir)/lib/randutils.c
 
 libuuid_la_DEPENDENCIES = uuid.sym
index 9bcd62c21b87b586ce8c089c779b9f9288474869..caa240e4be2cd1f6ec4da4f87799b93f738afb68 100644 (file)
@@ -94,6 +94,7 @@
 #include "uuidP.h"
 #include "uuidd.h"
 #include "randutils.h"
+#include "fileutils.h"
 
 #ifdef HAVE_TLS
 #define THREAD_LOCAL static __thread
@@ -368,20 +369,7 @@ static ssize_t read_all(int fd, char *buf, size_t count)
  */
 static void close_all_fds(void)
 {
-       int i, max;
-
-#if defined(HAVE_SYSCONF) && defined(_SC_OPEN_MAX)
-       max = sysconf(_SC_OPEN_MAX);
-#elif defined(HAVE_GETDTABLESIZE)
-       max = getdtablesize();
-#elif defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
-       struct rlimit rl;
-
-       getrlimit(RLIMIT_NOFILE, &rl);
-       max = rl.rlim_cur;
-#else
-       max = OPEN_MAX;
-#endif
+       int i, max = get_fd_tabsize();
 
        for (i=0; i < max; i++) {
                close(i);