aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-06-20 12:30:27 -0700
committerGitHub <noreply@github.com>2019-06-20 12:30:27 -0700
commitf65ddc09914050275eb8ddc0b8f805d2cdd3be46 (patch)
tree39ba9f9de4d01c48ae83406becb214d03821eeb3 /pkg
parentafc461c9bdbce5930f5aaa62bb3d196a2b44bcad (diff)
parentfa1b0a2d891d393d6762654d8385ef0347e1adfa (diff)
downloadpodman-f65ddc09914050275eb8ddc0b8f805d2cdd3be46.tar.gz
podman-f65ddc09914050275eb8ddc0b8f805d2cdd3be46.tar.bz2
podman-f65ddc09914050275eb8ddc0b8f805d2cdd3be46.zip
Merge pull request #3380 from openSUSE/asprintf-fix
Handle possible asprintf failure in rootless_linux.c
Diffstat (limited to 'pkg')
-rw-r--r--pkg/rootless/rootless_linux.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/rootless/rootless_linux.c b/pkg/rootless/rootless_linux.c
index 7be786ded..26dfc7b31 100644
--- a/pkg/rootless/rootless_linux.c
+++ b/pkg/rootless/rootless_linux.c
@@ -416,9 +416,16 @@ create_pause_process (const char *pause_pid_file_path, char **argv)
sprintf (pid_str, "%d", pid);
- asprintf (&tmp_file_path, "%s.XXXXXX", pause_pid_file_path);
+ if (asprintf (&tmp_file_path, "%s.XXXXXX", pause_pid_file_path) < 0)
+ {
+ fprintf (stderr, "unable to print to string\n");
+ kill (pid, SIGKILL);
+ _exit (EXIT_FAILURE);
+ }
+
if (tmp_file_path == NULL)
{
+ fprintf (stderr, "temporary file path is NULL\n");
kill (pid, SIGKILL);
_exit (EXIT_FAILURE);
}
@@ -426,6 +433,7 @@ create_pause_process (const char *pause_pid_file_path, char **argv)
fd = mkstemp (tmp_file_path);
if (fd < 0)
{
+ fprintf (stderr, "error creating temporary file: %s\n", strerror (errno));
kill (pid, SIGKILL);
_exit (EXIT_FAILURE);
}
@@ -433,6 +441,7 @@ create_pause_process (const char *pause_pid_file_path, char **argv)
r = TEMP_FAILURE_RETRY (write (fd, pid_str, strlen (pid_str)));
if (r < 0)
{
+ fprintf (stderr, "cannot write to file descriptor: %s\n", strerror (errno));
kill (pid, SIGKILL);
_exit (EXIT_FAILURE);
}