diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-01-15 08:34:24 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-01-15 08:34:24 +0000 |
| commit | c0a3f897757eda924c3f6f4768fa356e312c47bd (patch) | |
| tree | b4694f0f3410edcaff64481e62d54dbdfc1993d8 /main.c | |
| parent | Merge branch 'selection-extend-force-character-wise' (diff) | |
| parent | Add xsnprintf() and remove some unnecessary strlen(3) calls (diff) | |
Merge branch 'xsnprintf'
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -31,6 +31,7 @@ #include "util.h" #include "version.h" #include "xmalloc.h" +#include "xsnprintf.h" static volatile sig_atomic_t aborted = 0; @@ -127,9 +128,9 @@ print_pid(const char *pid_file, bool *unlink_at_exit) if (pid_fd >= 0) { char pid[32]; - snprintf(pid, sizeof(pid), "%u\n", getpid()); + size_t n = xsnprintf(pid, sizeof(pid), "%u\n", getpid()); - ssize_t bytes = write(pid_fd, pid, strlen(pid)); + ssize_t bytes = write(pid_fd, pid, n); close(pid_fd); if (bytes < 0) { |
