don't ignore asprintf() return value

This commit is contained in:
HW42 2015-01-23 00:15:01 +01:00 committed by Marek Marczykowski-Górecki
parent bc8a6a0a20
commit 13bca3d05f

View File

@ -66,7 +66,9 @@ int main(int argc __attribute((__unused__)), char ** argv __attribute__((__unuse
case -1: case -1:
gui_fatal("Failed to create new process"); gui_fatal("Failed to create new process");
case 0: case 0:
asprintf(&procdir_path, "/proc/%d/fd", getpid()); if (asprintf(&procdir_path, "/proc/%d/fd", getpid()) < 0) {
gui_fatal("Error allocating memory");
}
procfs_fd = open(procdir_path, O_DIRECTORY | O_RDONLY); procfs_fd = open(procdir_path, O_DIRECTORY | O_RDONLY);
if (procfs_fd < 0) if (procfs_fd < 0)
gui_fatal("Failed to open /proc"); gui_fatal("Failed to open /proc");