Skip to contentSkip to conversation

tools/xenstore/xenstore_core.c

PATCH In review Jerone Young 3 participants 3 messages Aug 11, 2005 – Aug 12, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/xenstore/xenstore_core.c

tmpout is initialized. Just print to the screen.

--- tools/xenstore/xenstored_core.old 2005-08-11 12:54:42.000000000
-0500
+++ tools/xenstore/xenstored_core.c 2005-08-11 12:55:16.000000000
-0500
@@ -1675,7 +1675,7 @@ int main(int argc, char *argv[])

        if (outputpid) {
                char buffer[20];
                sprintf(buffer, "%i\n", getpid());
-               write(tmpout, buffer, strlen(buffer));
+               printf("%i\n", buffer);
        }

        /* close stdin/stdout now we're ready to accept connections */
Signature · 4 lines
Jerone Young
IBM Linux Technology Center
[email protected]
512-838-1157 (T/L: 678-1157)
#1 lore raw

This one's a bug, but I don't think that's the right fix. Rusty?

-- Keir

Quoted 32 lines · Jerone Young

tmpout is initialized. Just print to the screen.

--- tools/xenstore/xenstored_core.old 2005-08-11 12:54:42.000000000
-0500
+++ tools/xenstore/xenstored_core.c 2005-08-11 12:55:16.000000000
-0500

(quoted diff) +1 -1
@@ -1675,7 +1675,7 @@ int main(int argc, char *argv[])
        if (outputpid) {
                char buffer[20];
                sprintf(buffer, "%i\n", getpid());
-               write(tmpout, buffer, strlen(buffer));
+               printf("%i\n", buffer);
        }
 
        /* close stdin/stdout now we're ready to accept connections */
Signature · 11 lines
-- 
Jerone Young
IBM Linux Technology Center
[email protected]
512-838-1157 (T/L: 678-1157)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
#2 lore raw
Quoted 1 line · Keir Fraser

This one's a bug, but I don't think that's the right fix. Rusty?

Yeah, we used to close stdout earlier, so this used a temporary dup'ed fd. It's now much simpler: nice spotting Jerone.

Rusty.

# HG changeset patch
# User Rusty Russell <[email protected]> # Node ID 1f532dacdc4870c235d57c55b2f6051b9ee40419 # Parent 822566f5cfddce3b641b5a1a119dfd592ec69158 Fix --output-pid (broken when we fixed --pid-file). Thanks to Jerone Young for spotting this.

tools/xenstore/xenstored_core.c +3 -4
diff -r 822566f5cfdd -r 1f532dacdc48 tools/xenstore/xenstored_core.c
@@ -1587,7 +1587,7 @@
 
 int main(int argc, char *argv[])
 {
-	int opt, *sock, *ro_sock, event_fd, max, tmpout;
+	int opt, *sock, *ro_sock, event_fd, max;
 	struct sockaddr_un addr;
 	fd_set inset, outset;
 	bool dofork = true;
@@ -1673,9 +1673,8 @@
 	restore_existing_connections();
 
 	if (outputpid) {
-		char buffer[20];
-		sprintf(buffer, "%i\n", getpid());
-		write(tmpout, buffer, strlen(buffer));
+		printf("%i\n", getpid());
+		fflush(stdout);
 	}
 
 	/* close stdin/stdout now we're ready to accept connections */
Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman