[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 2/3] do_lockfile: avoid printing wrong PID in status
From: |
Kamil Dudka |
Subject: |
[Nano-devel] [PATCH 2/3] do_lockfile: avoid printing wrong PID in status bar |
Date: |
Tue, 27 Jan 2015 17:46:47 +0100 |
... due to treating serialized PID bytes as singed integers
Bug: https://bugzilla.redhat.com/1186384
Reported-by: Don Swaner
---
trunk/nano/src/files.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/trunk/nano/src/files.c b/trunk/nano/src/files.c
index cbe46ae..43b8c13 100644
--- a/trunk/nano/src/files.c
+++ b/trunk/nano/src/files.c
@@ -284,7 +284,7 @@ int do_lockfile(const char *filename)
return -1;
}
strncpy(lockprog, &lockbuf[2], 10);
- lockpid = lockbuf[25] * 256 + lockbuf[24];
+ lockpid = (unsigned char)lockbuf[25] * 256 + (unsigned
char)lockbuf[24];
strncpy(lockuser, &lockbuf[28], 16);
#ifdef DEBUG
fprintf(stderr, "lockpid = %d\n", lockpid);
--
2.1.0