Re: [PATCH 01/49] create_inode: clean up return mess in do_write_internal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 11, 2014 at 05:08:53PM -0400, Theodore Ts'o wrote:
> On Tue, Mar 11, 2014 at 01:41:31PM -0700, Darrick J. Wong wrote:
> > > This seems a bit strange.  It looks like an error return, but it will
> > > actually return "0" since this branch is only entered if retval == 0.
> > > Should this return an explicit error value here?
> > 
> > You're right; maybe we should return EXT2_ET_FILE_EXISTS or something?
> 
> EXT2_ET_FILE_EXISTS sounds good to me.

Thanks, applied, with the following change:

diff --git a/misc/create_inode.c b/misc/create_inode.c
index 647480c..fb6b800 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -351,9 +351,8 @@ errcode_t do_write_internal(ext2_ino_t cwd, const char *src, const char *dest)
 
 	retval = ext2fs_namei(current_fs, root, cwd, dest, &newfile);
 	if (retval == 0) {
-		com_err(__func__, 0, "The file '%s' already exists\n", dest);
 		close(fd);
-		return retval;
+		return EXT2_ET_FILE_EXISTS;
 	}
 
 	retval = ext2fs_new_inode(current_fs, cwd, 010755, 0, &newfile);
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux