X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=string.c;h=ba32e8bfbddc9b314cfcf78011b4f85bc6322906;hp=752fb8f945d1a381b7b7af4e65ed56b646df8d47;hb=8221397af24a2df3c2edbc889847ce0ab15eb3e0;hpb=49bd626084bf5f48e4d80075258b6da4703752cf diff --git a/string.c b/string.c index 752fb8f9..ba32e8bf 100644 --- a/string.c +++ b/string.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Andre Noll + * Copyright (C) 2004-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -59,9 +59,10 @@ __must_check __malloc void *para_realloc(void *p, size_t size) */ __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,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. *