diff options
author | Theodore Ts'o <tytso@mit.edu> | 2002-10-31 11:53:49 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2002-10-31 11:53:49 -0500 |
commit | 1dd090faa03a781492791ce9eacf4fd5ecbf425f (patch) | |
tree | 52327b995cd0ab1481f1c1a3c2f0dc7368165407 /debugfs | |
parent | 9ed06a1eb90efbc3290c1b5a56e0e09d243f95da (diff) | |
download | e2fsprogs-1dd090faa03a781492791ce9eacf4fd5ecbf425f.tar.gz |
debugfs.c (do_write): Check to see if the filename exists before
creating it, and give an error if so. Addresses
Sourceforge bug #478195.
Diffstat (limited to 'debugfs')
-rw-r--r-- | debugfs/ChangeLog | 6 | ||||
-rw-r--r-- | debugfs/debugfs.c | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index 71b1909b..f10078af 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,9 @@ +2002-10-31 Theodore Ts'o <tytso@mit.edu> + + * debugfs.c (do_write): Check to see if the filename exists before + creating it, and give an error if so. Addresses + Sourceforge bug #478195. + 2002-10-30 Theodore Ts'o <tytso@mit.edu> * Makefile.in (install): Search all compression extensions when diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index e2f59c51..22941046 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -1097,6 +1097,13 @@ void do_write(int argc, char *argv[]) return; } + retval = ext2fs_namei(current_fs, root, cwd, argv[2], &newfile); + if (retval == 0) { + com_err(argv[0], 0, "The file '%s' already exists\n", argv[2]); + close(fd); + return; + } + retval = ext2fs_new_inode(current_fs, cwd, 010755, 0, &newfile); if (retval) { com_err(argv[0], retval, ""); |