summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorAnand V. Avati <avati@gluster.com>2009-03-26 16:26:21 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-03-26 17:09:18 +0530
commita59582c3faed3efcf713caeb990ea5c35479dd8d (patch)
tree7f8c59cffb28c601ec5c83eb34f41a69d0e8ff0b /xlators/storage
parent36e39bf9cb4b7c712ef411d60203bf05af7e129f (diff)
posix_unlink - open/unlink/close only regular files
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index c20c7fec4..a2635e6ee 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);