/*
- * Copyright (C) 2004-2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2004-2009 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
*/
__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);
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.
*