build: avoid close, system

* src/fdstream.c (virFDStreamOpenFile, virFDStreamCreateFile):
Use VIR_FORCE_CLOSE instead of close.
* tests/commandtest.c (mymain): Likewise.
* tools/virsh.c (editFile): Use virCommand instead of system.
* src/util/util.c (__virExec): Special case preservation of std
file descriptors to child.
This commit is contained in:
Eric Blake
2011-01-28 14:22:39 -07:00
parent dc52cab126
commit e67ae61991
4 changed files with 52 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
/*
* commandtest.c: Test the libCommand API
*
* Copyright (C) 2010 Red Hat, Inc.
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -714,6 +714,7 @@ mymain(int argc, char **argv)
{
int ret = 0;
char cwd[PATH_MAX];
int fd;
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
@@ -731,9 +732,12 @@ mymain(int argc, char **argv)
/* Kill off any inherited fds that might interfere with our
* testing. */
close(3);
close(4);
close(5);
fd = 3;
VIR_FORCE_CLOSE(fd);
fd = 4;
VIR_FORCE_CLOSE(fd);
fd = 5;
VIR_FORCE_CLOSE(fd);
virInitialize();