s3: Fix uninitialized variable in OneFS streams
authorTim Prouty <tprouty@samba.org>
Mon, 12 Jan 2009 07:16:37 +0000 (23:16 -0800)
committerTim Prouty <tprouty@samba.org>
Mon, 12 Jan 2009 07:29:14 +0000 (23:29 -0800)
source3/modules/onefs_streams.c

index 55ce11ecf5521e973616d07bba4694824dd8a03d..184fe4f0c99a4edc38c7422739bd0b0bcdb85644 100644 (file)
@@ -132,7 +132,8 @@ int onefs_rename(vfs_handle_struct *handle, const char *oldname,
 {
        TALLOC_CTX *frame = NULL;
        int ret = -1;
-       int dir_fd, saved_errno;
+       int dir_fd = -1;
+       int saved_errno;
        bool old_is_stream;
        bool new_is_stream;
        char *obase = NULL;
@@ -182,7 +183,9 @@ int onefs_rename(vfs_handle_struct *handle, const char *oldname,
 
  done:
        saved_errno = errno;
-       close(dir_fd);
+       if (dir_fd >= 0) {
+               close(dir_fd);
+       }
        errno = saved_errno;
        TALLOC_FREE(frame);
        return ret;