Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ccan/closefrom/closefrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static bool can_open_proc_pid_fd(void)
char dnam[PROC_PID_FD_LEN];
DIR *dir;

sprintf(dnam, "/proc/%ld/fd", (long) getpid());
snprintf(dnam, sizeof(dnam), "/proc/%ld/fd", (long) getpid());
dir = opendir(dnam);
if (!dir)
return false;
Expand Down Expand Up @@ -159,7 +159,7 @@ void closefrom(int fromfd)

maxfd = sysconf(_SC_OPEN_MAX);

sprintf(dnam, "/proc/%ld/fd", (long) getpid());
snprintf(dnam, sizeof(dnam), "/proc/%ld/fd", (long) getpid());
dir = try_opendir(dnam, &fromfd, maxfd);
if (!dir)
dir = try_opendir("/dev/fd", &fromfd, maxfd);
Expand Down