aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2012-12-04 10:36:54 -0500
committerBill Nottingham <notting@redhat.com>2012-12-07 15:36:57 -0500
commit3fe9ada07f2bcc963f39a27b63caf42810a103f8 (patch)
tree133391655aa0ea0b8fab6cf2a1ef2e854ee79492
parent6548420e7155949e703d09519e54e364878f67bd (diff)
downloadinitscripts-3fe9ada07f2bcc963f39a27b63caf42810a103f8.tar
initscripts-3fe9ada07f2bcc963f39a27b63caf42810a103f8.tar.gz
initscripts-3fe9ada07f2bcc963f39a27b63caf42810a103f8.tar.bz2
initscripts-3fe9ada07f2bcc963f39a27b63caf42810a103f8.tar.xz
initscripts-3fe9ada07f2bcc963f39a27b63caf42810a103f8.zip
Fix amazingly long-standing thinko in writing the pid file to the lock.
-rw-r--r--src/rename_device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rename_device.c b/src/rename_device.c
index f96291b0..c6a99152 100644
--- a/src/rename_device.c
+++ b/src/rename_device.c
@@ -241,7 +241,10 @@ void take_lock() {
while (1) {
lockfd = open(LOCKFILE, O_RDWR|O_CREAT|O_EXCL, 0644);
if (lockfd != -1) {
- write(lockfd,"%d\n",getpid());
+ char buf[32];
+
+ snprintf(buf,32,"%d\n",getpid());
+ write(lockfd,buf,strlen(buf));
close(lockfd);
break;
}