]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge commit 'meins/master'
authorAndre Noll <maan@systemlinux.org>
Fri, 9 Jan 2009 00:16:44 +0000 (01:16 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 9 Jan 2009 00:16:44 +0000 (01:16 +0100)
fd.c
fd.h
string.c
string.h

diff --git a/fd.c b/fd.c
index d0b5c895a5f25d02b9f566fbe693a38898057203..c675aaffd4b99083d3ab0e26445574c2b87ad51b 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -427,3 +427,24 @@ again:
                goto again;
        return ret;
 }
+
+/**
+ * Ensure that file descriptors 0, 1, and 2 are valid.
+ *
+ * Common approach that opens /dev/null until it gets a file descriptor greater
+ * than two.
+ *
+ * \sa okir's Black Hats Manual.
+ */
+void valid_fd_012(void)
+{
+       while (1) {
+               int fd = open("/dev/null", O_RDWR);
+               if (fd < 0)
+                       exit(EXIT_FAILURE);
+               if (fd > 2) {
+                       close(fd);
+                       break;
+               }
+       }
+}
diff --git a/fd.h b/fd.h
index 22141be2d79a7451188f0d6986b772368248ff71..ae692b4fbe00dad1efc33237700d41f4524c825f 100644 (file)
--- a/fd.h
+++ b/fd.h
@@ -24,3 +24,4 @@ int mmap_full_file(const char *filename, int open_mode, void **map,
        size_t *size, int *fd_ptr);
 int para_munmap(void *start, size_t length);
 int write_ok(int fd);
+void valid_fd_012(void);
index d23e43c1eecb1d34e4eaefda77423da076ab412a..bdc113d3586c63059311968275f6134f5a9037b9 100644 (file)
--- a/string.c
+++ b/string.c
@@ -328,27 +328,6 @@ __must_check unsigned split_args(char *args, char *** const argv_ptr, const char
        return n;
 }
 
-/**
- * Ensure that file descriptors 0, 1, and 2 are valid.
- *
- * Common approach that opens /dev/null until it gets a file descriptor greater
- * than two.
- *
- * \sa okir's Black Hats Manual.
- */
-void valid_fd_012(void)
-{
-       while (1) {
-               int fd = open("/dev/null", O_RDWR);
-               if (fd < 0)
-                       exit(EXIT_FAILURE);
-               if (fd > 2) {
-                       close(fd);
-                       break;
-               }
-       }
-}
-
 /**
  * Get the own hostname.
  *
index 561ff4e8705c4d20baf0b01999503f725cadb820..e91a140be0ae6c8dc2371e027d5326d470209f68 100644 (file)
--- a/string.h
+++ b/string.h
@@ -40,7 +40,6 @@ __must_check __malloc char *para_logname(void);
 __must_check __malloc char *para_homedir(void);
 __must_check unsigned split_args(char *args, char *** const argv_ptr, const char *delim);
 __malloc char *para_hostname(void);
-void valid_fd_012(void);
 __printf_2_3 int para_printf(struct para_buffer *b, const char *fmt, ...);
 /** Used for for_each_line() and for_each_line_ro(). */
 typedef int line_handler_t(char *, void *);