]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs, tune2fs: remove unneeded access() call
authorTheodore Ts'o <tytso@mit.edu>
Sat, 11 Jan 2014 02:39:27 +0000 (21:39 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 11 Jan 2014 02:39:27 +0000 (21:39 -0500)
Addresses-Coverity-Id: #709536
Addresses-Coverity-Id: #709535

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/mke2fs.c
misc/tune2fs.c

index 10d3211408cb2841d5511cd3fc5176babaae3914..c45b42f13400c079788905c8fa2396ab53daa18c 100644 (file)
@@ -2254,11 +2254,9 @@ static int mke2fs_setup_tdb(const char *name, io_manager *io_ptr)
        sprintf(tdb_file, "%s/mke2fs-%s.e2undo", tdb_dir, dev_name);
        free(tmp_name);
 
-       if (!access(tdb_file, F_OK)) {
-               if (unlink(tdb_file) < 0) {
-                       retval = errno;
-                       goto errout;
-               }
+       if ((unlink(tdb_file) < 0) && (errno != ENOENT)) {
+               retval = errno;
+               goto errout;
        }
 
        set_undo_io_backing_manager(*io_ptr);
index 568fb30d9e8875991e1e822d49045f90be0b56be..b8cd347ebd13be3addb63a4d04b3165cc2fe84c0 100644 (file)
@@ -1856,15 +1856,12 @@ static int tune2fs_setup_tdb(const char *name, io_manager *io_ptr)
                goto alloc_fn_fail;
        sprintf(tdb_file, "%s/tune2fs-%s.e2undo", tdb_dir, dev_name);
 
-       if (!access(tdb_file, F_OK)) {
-               if (unlink(tdb_file) < 0) {
-                       retval = errno;
-                       com_err(program_name, retval,
-                               _("while trying to delete %s"),
-                               tdb_file);
-                       free(tdb_file);
-                       return retval;
-               }
+       if ((unlink(tdb_file) < 0) && (errno != ENOENT)) {
+               retval = errno;
+               com_err(program_name, retval,
+                       _("while trying to delete %s"), tdb_file);
+               free(tdb_file);
+               return retval;
        }
 
        set_undo_io_backing_manager(*io_ptr);