Coverity: TOCTOU: CID 390
authorNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 22 Feb 2012 23:29:43 +0000 (18:29 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 22 Feb 2012 23:29:43 +0000 (18:29 -0500)
* lib-src/movemail.c (main): No need to check access to outname,
since open will fail and we are not giving any better diagnosis.

* lib-src/movemail.c (main): Ditto for inname.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
lib-src/movemail.c

index 89760f8..ba22f92 100644 (file)
@@ -315,11 +315,6 @@ int main(int argc, char *argv[])
        if (*outname == 0)
                fatal("Destination file name is empty", 0);
 
-       VERBOSE(("checking access to output file\n"));
-       /* Check access to output file.  */
-       if (access(outname, F_OK) == 0 && access(outname, W_OK) != 0)
-               pfatal_with_name(outname);
-
        /* Also check that outname's directory is writable to the real uid.  */
        {
                char *buf = (char *)xmalloc(strlen(outname) + 1);
@@ -345,9 +340,6 @@ int main(int argc, char *argv[])
 
 #ifndef DISABLE_DIRECT_ACCESS
 
-       /* Check access to input file.  */
-       if (access(inname, R_OK | W_OK) != 0)
-               pfatal_with_name(inname);
 
        if (fork() == 0) {
                setuid(getuid());