]> Git Repo - qemu.git/commitdiff
qemu-ga: make reopen_fd_to_null() public
authorLuiz Capitulino <[email protected]>
Thu, 10 May 2012 19:50:41 +0000 (16:50 -0300)
committerMichael Roth <[email protected]>
Tue, 15 May 2012 14:15:16 +0000 (09:15 -0500)
The next commit wants to use it.

Signed-off-by: Luiz Capitulino <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Michael Roth <[email protected]>
qemu-ga.c
qga/commands-posix.c
qga/guest-agent-core.h

index cf61cb95e5c104737c848341bb79b34530ddcc49..8d53e04a0fcb1c0683e98110784f8043cd5f8165 100644 (file)
--- a/qemu-ga.c
+++ b/qemu-ga.c
@@ -140,6 +140,23 @@ static gboolean register_signal_handlers(void)
 
     return true;
 }
+
+/* TODO: use this in place of all post-fork() fclose(std*) callers */
+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
 
 static void usage(const char *cmd)
index e448431c66e658068e9dc94b6337e83089c1d296..adb9b3db8dadbd9f77cbe79664f6eea33e26c9bb 100644 (file)
 #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;
index bbb8b9b125056655bf9db11a74c7972650f5aaa0..6dba10484d70be3dc1d4d05e7a06fe865ab2ae19 100644 (file)
@@ -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
This page took 0.031298 seconds and 4 git commands to generate.