mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user