f26bf7c sync: fix open() fallback bug

Authored and Committed by kdudka 5 years ago
    sync: fix open() fallback bug
    
    Detected by Coverity Analysis:
    
    Error: RESOURCE_LEAK (CWE-772):
    coreutils-8.30/src/sync.c:112: open_fn: Returning handle opened by "open". [Note: The source code implementation of the function has been overridden by a user model.]
    coreutils-8.30/src/sync.c:112: var_assign: Assigning: "fd" = handle returned from "open(file, 2049)".
    coreutils-8.30/src/sync.c:115: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
    113|         if (fd < 0)
    114|           error (0, rd_errno, _("error opening %s"), quoteaf (file));
    115|->       return false;
    116|       }
    117|
    
    Bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33287
    
        
file modified
+4 -0