1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

Handle all succefull values from open()

This commit is contained in:
Zdenek Kabelac 2012-02-13 12:07:51 +00:00
parent e66b3e8e3b
commit 424f6dc4ad

View File

@ -1149,7 +1149,7 @@ static const char *_get_cmdline(pid_t pid)
snprintf(buf, sizeof(buf), DEFAULT_PROC_DIR "/%u/cmdline", pid);
/* FIXME Use generic read code. */
if ((fd = open(buf, O_RDONLY)) > 0) {
if ((fd = open(buf, O_RDONLY)) >= 0) {
if ((n = read(fd, _proc_cmdline, sizeof(_proc_cmdline) - 1)) < 0) {
log_sys_error("read", buf);
n = 0;