# HG changeset patch
# User john.levon(a)sun.com
# Date 1229367890 28800
# Node ID c324c231c6a50be9f970f0f6c6d1629a7c09ab3b
# Parent 63174fd9f33749cb68431fd5d1ff6133ba48863b
Remove _PATH_DEVNULL usage
_PATH_DEVNULL provides no apparent advantage, and isn't available on
Solaris: replace with the string literal.
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/qemud/qemud.c b/qemud/qemud.c
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -397,9 +397,9 @@ static int qemudGoDaemon(void) {
int stdoutfd = -1;
int nextpid;
- if ((stdinfd = open(_PATH_DEVNULL, O_RDONLY)) < 0)
+ if ((stdinfd = open("/dev/null", O_RDONLY)) < 0)
goto cleanup;
- if ((stdoutfd = open(_PATH_DEVNULL, O_WRONLY)) < 0)
+ if ((stdoutfd = open("/dev/null", O_WRONLY)) < 0)
goto cleanup;
if (dup2(stdinfd, STDIN_FILENO) != STDIN_FILENO)
goto cleanup;
diff --git a/src/util.c b/src/util.c
--- a/src/util.c
+++ b/src/util.c
@@ -205,10 +205,10 @@ __virExec(virConnectPtr conn,
return -1;
}
- if ((null = open(_PATH_DEVNULL, O_RDONLY)) < 0) {
+ if ((null = open("/dev/null", O_RDONLY)) < 0) {
ReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot open %s: %s"),
- _PATH_DEVNULL, strerror(errno));
+ "/dev/null", strerror(errno));
goto cleanup;
}
diff --git a/tests/testutils.c b/tests/testutils.c
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -35,10 +35,6 @@
#ifdef HAVE_PATHS_H
#include <paths.h>
-#endif
-
-#ifndef _PATH_DEVNULL
-#define _PATH_DEVNULL "/dev/null"
#endif
#define GETTIMEOFDAY(T) gettimeofday(T, NULL)
@@ -157,9 +153,9 @@ void virtTestCaptureProgramExecChild(con
NULL
};
- if ((stdinfd = open(_PATH_DEVNULL, O_RDONLY)) < 0)
- goto cleanup;
- if ((stderrfd = open(_PATH_DEVNULL, O_WRONLY)) < 0)
+ if ((stdinfd = open("/dev/null", O_RDONLY)) < 0)
+ goto cleanup;
+ if ((stderrfd = open("/dev/null", O_WRONLY)) < 0)
goto cleanup;
open_max = sysconf (_SC_OPEN_MAX);