diff options
author | Anand V. Avati <avati@gluster.com> | 2009-03-26 16:26:21 +0530 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-03-26 17:09:18 +0530 |
commit | a59582c3faed3efcf713caeb990ea5c35479dd8d (patch) | |
tree | 7f8c59cffb28c601ec5c83eb34f41a69d0e8ff0b | |
parent | 36e39bf9cb4b7c712ef411d60203bf05af7e129f (diff) |
posix_unlink - open/unlink/close only regular files
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r-- | xlators/storage/posix/src/posix.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index c20c7fec454..a2635e6eee3 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -864,13 +864,16 @@ posix_unlink (call_frame_t *frame, xlator_t *this, SET_FS_ID (frame->root->uid, frame->root->gid); MAKE_REAL_PATH (real_path, this, loc->path); - fd = open (real_path, O_RDONLY); - if (fd == -1) { - op_ret = -1; - op_errno = errno; - gf_log (this->name, GF_LOG_WARNING, - "open of %s failed: %s", loc->path, strerror (op_errno)); - goto out; + if (S_ISREG (loc->inode->st_mode)) { + fd = open (real_path, O_RDONLY); + if (fd == -1) { + op_ret = -1; + op_errno = errno; + gf_log (this->name, GF_LOG_WARNING, + "open of %s failed: %s", loc->path, + strerror (op_errno)); + goto out; + } } op_ret = unlink (real_path); |