rexec: convert to strnprintf()

parent c937bea7
...@@ -98,9 +98,9 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name) ...@@ -98,9 +98,9 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name)
if (memfd < 0) { if (memfd < 0) {
char template[PATH_MAX]; char template[PATH_MAX];
ret = snprintf(template, sizeof(template), ret = strnprintf(template, sizeof(template),
P_tmpdir "/.%s_XXXXXX", memfd_name); P_tmpdir "/.%s_XXXXXX", memfd_name);
if (ret < 0 || (size_t)ret >= sizeof(template)) if (ret < 0)
return; return;
tmpfd = lxc_make_tmpfile(template, true); tmpfd = lxc_make_tmpfile(template, true);
...@@ -151,8 +151,8 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name) ...@@ -151,8 +151,8 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name)
} else { } else {
char procfd[LXC_PROC_PID_FD_LEN]; char procfd[LXC_PROC_PID_FD_LEN];
ret = snprintf(procfd, sizeof(procfd), "/proc/self/fd/%d", tmpfd); ret = strnprintf(procfd, sizeof(procfd), "/proc/self/fd/%d", tmpfd);
if (ret < 0 || (size_t)ret >= sizeof(procfd)) if (ret < 0)
return; return;
execfd = open(procfd, O_PATH | O_CLOEXEC); execfd = open(procfd, O_PATH | O_CLOEXEC);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment