]> 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)
1  2 
fd.c
string.c

diff --combined fd.c
index 8fc1abad19057bd724f26a25dca2ddb3ba5003ee,d0b5c895a5f25d02b9f566fbe693a38898057203..c675aaffd4b99083d3ab0e26445574c2b87ad51b
--- 1/fd.c
--- 2/fd.c
+++ b/fd.c
@@@ -285,9 -285,10 +285,10 @@@ int para_opendir(const char *dirname, D
        if (*dir)
                return 1;
        ret = -ERRNO_TO_PARA_ERROR(errno);
- /* Ignore return value of fchdir() and close(). We're busted anyway. */
-       if (cwd)
-               fchdir(*cwd);
+       /* Ignore return value of fchdir() and close(). We're busted anyway. */
+       if (cwd) {
+               int __a_unused ret2 = fchdir(*cwd); /* STFU, gcc */
+       }
  close_cwd:
        if (cwd)
                close(*cwd);
@@@ -426,24 -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 --combined string.c
index c73ec1e6d70377b24bafcb9462035067099fc945,d23e43c1eecb1d34e4eaefda77423da076ab412a..bdc113d3586c63059311968275f6134f5a9037b9
+++ b/string.c
@@@ -59,9 -59,10 +59,10 @@@ __must_check __malloc void *para_reallo
   */
  __must_check __malloc void *para_malloc(size_t size)
  {
-       assert(size);
-       void *p = malloc(size);
+       void *p;
  
+       assert(size);
+       p = malloc(size);
        if (!p) {
                PARA_EMERG_LOG("malloc failed (size = %zu),  aborting\n",
                        size);
@@@ -327,6 -328,27 +328,6 @@@ __must_check unsigned split_args(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.
   *