]> git.saurik.com Git - apple/hfs.git/blobdiff - core/hfs_vnops.c
hfs-556.100.11.tar.gz
[apple/hfs.git] / core / hfs_vnops.c
index 237f071a12bfe95356231708597dd7eb088c463c..cf6d106c59e3937b208f68af45a38461ad49bda2 100644 (file)
@@ -5538,10 +5538,6 @@ hfs_vnop_symlink(struct vnop_symlink_args *ap)
        if (VTOVCB(dvp)->vcbSigWord != kHFSPlusSigWord)
                return (ENOTSUP);
 
-       /* Check for empty target name */
-       if (ap->a_target[0] == 0)
-               return (EINVAL);
-
        hfsmp = VTOHFS(dvp);
        
        len = strlen(ap->a_target);
@@ -5569,6 +5565,9 @@ hfs_vnop_symlink(struct vnop_symlink_args *ap)
            goto out;
        }
 
+       if (!len)
+               goto out;
+
 #if QUOTA
        (void)hfs_getinoquota(cp);
 #endif /* QUOTA */
@@ -6063,10 +6062,21 @@ hfs_vnop_readlink(struct vnop_readlink_args *ap)
        fp = VTOF(vp);
    
        /* Zero length sym links are not allowed */
-       if (fp->ff_size == 0 || fp->ff_size > MAXPATHLEN) {
+       if (fp->ff_size > MAXPATHLEN) {
                error = EINVAL;
                goto exit;
        }
+
+       /*
+        * If this is an empty symlink, we are done. The call to uiomove() is
+        * just for debug and diagnostics.
+        */
+       if (fp->ff_size == 0) {
+               static uint8_t empty_str[] = {'\0'};
+
+               error = uiomove((caddr_t)empty_str, 0, ap->a_uio);
+               goto exit;
+       }
     
        /* Cache the path so we don't waste buffer cache resources */
        if (fp->ff_symlinkptr == NULL) {