s3: Simplify the code a bit: Catch (len==0) early
authorVolker Lendecke <vl@samba.org>
Wed, 3 Feb 2010 06:37:29 +0000 (07:37 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 3 Feb 2010 20:34:25 +0000 (12:34 -0800)
source3/modules/vfs_expand_msdfs.c

index 177ebdb928b43d17675da96892fc6df9fbc599cf..0772215a284ac67b35a9c9e3c689e64c87893115 100644 (file)
@@ -187,7 +187,7 @@ static int expand_msdfs_readlink(struct vfs_handle_struct *handle,
        result = SMB_VFS_NEXT_READLINK(handle, path, target,
                                       PATH_MAX);
 
-       if (result < 0)
+       if (result <= 0)
                return result;
 
        target[result] = '\0';
@@ -202,12 +202,9 @@ static int expand_msdfs_readlink(struct vfs_handle_struct *handle,
        }
 
        len = MIN(bufsiz, strlen(target));
-       if (len) {
-               memcpy(buf, target, len);
-       } else {
-               errno = ENOENT;
-               return -1;
-       }
+
+       memcpy(buf, target, len);
+
        TALLOC_FREE(target);
        return len;
 }