Module Name:    src
Committed By:   pooka
Date:           Thu Jan 20 15:00:13 UTC 2011

Modified Files:
        src/lib/librumpuser: rumpuser.c

Log Message:
include pid of rump server in hostname


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/librumpuser/rumpuser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumpuser/rumpuser.c
diff -u src/lib/librumpuser/rumpuser.c:1.12 src/lib/librumpuser/rumpuser.c:1.13
--- src/lib/librumpuser/rumpuser.c:1.12	Wed Jan  5 09:43:00 2011
+++ src/lib/librumpuser/rumpuser.c	Thu Jan 20 15:00:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.c,v 1.12 2011/01/05 09:43:00 pooka Exp $	*/
+/*	$NetBSD: rumpuser.c,v 1.13 2011/01/20 15:00:12 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser.c,v 1.12 2011/01/05 09:43:00 pooka Exp $");
+__RCSID("$NetBSD: rumpuser.c,v 1.13 2011/01/20 15:00:12 pooka Exp $");
 #endif /* !lint */
 
 /* thank the maker for this */
@@ -491,8 +491,17 @@
 int
 rumpuser_gethostname(char *name, size_t namelen, int *error)
 {
+	char tmp[MAXHOSTNAMELEN];
 
-	DOCALL(int, (gethostname(name, namelen)));
+	if (gethostname(tmp, sizeof(tmp)) == -1) {
+		snprintf(name, namelen, "rump-%05d.rumpdomain", getpid());
+	} else {
+		snprintf(name, namelen, "rump-%05d.%s.rumpdomain",
+		    getpid(), tmp);
+	}
+
+	*error = 0;
+	return 0;
 }
 
 int

Reply via email to