Don't use a manually-sized buffer for the PID.
Change-Id: Ibdda590b828c61caa488e959f3e596dc981a2c65
diff --git a/server/main.cpp b/server/main.cpp
index 9e84c1c..cf3d5ec 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -126,8 +126,8 @@
}
static bool write_pid_file() {
- char pid_buf[20]; // current pid_max is 32768, so plenty of room
- snprintf(pid_buf, sizeof(pid_buf), "%ld\n", (long)getpid());
+ char pid_buf[INT32_STRLEN];
+ snprintf(pid_buf, sizeof(pid_buf), "%d\n", (int) getpid());
int fd = open(PID_FILE_PATH, PID_FILE_FLAGS, PID_FILE_MODE);
if (fd == -1) {