From: Theodore Ts'o Date: Sat, 11 Jan 2014 02:39:27 +0000 (-0500) Subject: mke2fs, tune2fs: remove unneeded access() call X-Git-Tag: v1.42.10~113 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=250bf9a7032fa13dad8eede903d17f3ec2e917de;p=thirdparty%2Fe2fsprogs.git mke2fs, tune2fs: remove unneeded access() call Addresses-Coverity-Id: #709536 Addresses-Coverity-Id: #709535 Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 10d321140..c45b42f13 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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); diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 568fb30d9..b8cd347eb 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -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);