summaryrefslogtreecommitdiffstats
path: root/sandbox/linux/suid/linux_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/linux/suid/linux_util.c')
-rw-r--r--sandbox/linux/suid/linux_util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sandbox/linux/suid/linux_util.c b/sandbox/linux/suid/linux_util.c
index ded545b..c5af0d0 100644
--- a/sandbox/linux/suid/linux_util.c
+++ b/sandbox/linux/suid/linux_util.c
@@ -83,8 +83,9 @@ bool FindProcessHoldingSocket(pid_t* pid_out, ino_t socket_inode) {
continue;
while ((dent = readdir(fd))) {
- if (snprintf(buf, sizeof(buf), "/proc/%lu/fd/%s", pid_ul,
- dent->d_name) >= sizeof(buf) - 1) {
+ int printed = snprintf(buf, sizeof(buf), "/proc/%lu/fd/%s", pid_ul,
+ dent->d_name);
+ if (printed < 0 || printed >= (int)(sizeof(buf) - 1)) {
continue;
}