Skip to contentSkip to conversation

qemu-ga: ga_open_pidfile(): add new line to pidfile

PATCH Superseded Luiz Capitulino 2 participants 2 messages Oct 3, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-ga: ga_open_pidfile(): add new line to pidfile

FHS dictates that pid files should end with a new line.

---
 qemu-ga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-ga.c +1 -1
index b747470..afd685e 100644
@@ -255,7 +255,7 @@ static bool ga_open_pidfile(const char *pidfile)
         g_critical("Failed to truncate pid file");
         goto fail;
     }
-    sprintf(pidstr, "%d", getpid());
+    sprintf(pidstr, "%d\n", getpid());
     if (write(pidfd, pidstr, strlen(pidstr)) != strlen(pidstr)) {
         g_critical("Failed to write pid file");
         goto fail;
Signature · 1 line
1.7.12.315.g682ce8b
#1 lore raw
Quoted 12 lines · Luiz Capitulino

FHS dictates that pid files should end with a new line.

---
 qemu-ga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-ga.c +0 -0
index b747470..afd685e 100644

qemu-ga.c static bool ga_open_pidfile(const char *pidfile) · line 258

Quoted 5 lines
qemu-ga.c +1 -1
@@ -255,7 +255,7 @@ static bool ga_open_pidfile(const char *pidfile)
         g_critical("Failed to truncate pid file");
         goto fail;
     }
-    sprintf(pidstr, "%d", getpid());
+    sprintf(pidstr, "%d\n", getpid());

Please convert to snprintf() while at it.

Quoted 7 lines
qemu-ga.c +0 -1
     if (write(pidfd, pidstr, strlen(pidstr)) != strlen(pidstr)) {
         g_critical("Failed to write pid file");
         goto fail;
--

1.7.12.315.g682ce8b