aboutsummaryrefslogtreecommitdiff
path: root/qga
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2012-05-10 16:50:41 -0300
committerMichael Roth <mdroth@linux.vnet.ibm.com>2012-05-15 09:15:16 -0500
commit04b4e75f33ae0775d70b8e33080f46d66275cdcc (patch)
treed6ec33bf787cc012c9f85c6cdd07ac83f1ad6c44 /qga
parentd9fcd2a1c825791cec9b21e634013b728422972f (diff)
downloadqemu-04b4e75f33ae0775d70b8e33080f46d66275cdcc.zip
qemu-04b4e75f33ae0775d70b8e33080f46d66275cdcc.tar.gz
qemu-04b4e75f33ae0775d70b8e33080f46d66275cdcc.tar.bz2
qemu-ga: make reopen_fd_to_null() public
The next commit wants to use it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga')
-rw-r--r--qga/commands-posix.c19
-rw-r--r--qga/guest-agent-core.h4
2 files changed, 4 insertions, 19 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index e448431..adb9b3d 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -34,25 +34,6 @@
#endif
#endif
-#if defined(__linux__)
-/* TODO: use this in place of all post-fork() fclose(std*) callers */
-static void reopen_fd_to_null(int fd)
-{
- int nullfd;
-
- nullfd = open("/dev/null", O_RDWR);
- if (nullfd < 0) {
- return;
- }
-
- dup2(nullfd, fd);
-
- if (nullfd != fd) {
- close(nullfd);
- }
-}
-#endif /* defined(__linux__) */
-
void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
{
int ret;
diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h
index bbb8b9b..6dba104 100644
--- a/qga/guest-agent-core.h
+++ b/qga/guest-agent-core.h
@@ -35,3 +35,7 @@ void ga_set_response_delimited(GAState *s);
bool ga_is_frozen(GAState *s);
void ga_set_frozen(GAState *s);
void ga_unset_frozen(GAState *s);
+
+#ifndef _WIN32
+void reopen_fd_to_null(int fd);
+#endif