efreetd: handle invalid fd in all cases
authorStefan Schmidt <stefan@osg.samsung.com>
Mon, 5 Dec 2016 15:05:12 +0000 (16:05 +0100)
committerStefan Schmidt <stefan@osg.samsung.com>
Mon, 5 Dec 2016 16:07:39 +0000 (17:07 +0100)
Very unlikely that we will get a -1 when opening /dev/null but you never know
what kind of system you are running on.

CID: 1361759

src/bin/efreet/efreetd.c

index 839cd60..8ed670d 100644 (file)
@@ -72,6 +72,10 @@ main(int argc, char *argv[])
    else
      {
         fd = open("/dev/null", O_WRONLY);
+        if (fd < 0)
+          {
+             goto tmp_error;
+          }
      }
    log = fdopen(fd, "wb");
    if (!log) goto tmp_error;