Fix an instance of errno pollution 66/221266/2
authorMichal Bloch <m.bloch@partner.samsung.com>
Mon, 30 Dec 2019 18:15:30 +0000 (19:15 +0100)
committerMichal Bloch <m.bloch@partner.samsung.com>
Mon, 30 Dec 2019 18:55:47 +0000 (19:55 +0100)
Change-Id: Iecfb9e9639a6ddf81ea038e844da66e46cfc0287
Signed-off-by: Michal Bloch <m.bloch@partner.samsung.com>
src/common/config-parser.c

index 627fc0a..a89af9e 100644 (file)
@@ -196,8 +196,9 @@ int config_parse_new(const char *filename, void *table)
 
        f = fopen(filename, "r");
        if (!f) {
-               _E("Failed to open file %s", filename);
-               return -errno;
+               const int saved_errno = errno;
+               _E("Failed to open file %s", filename); // can modify errno
+               return -saved_errno;
        }
 
        while (!feof(f)) {