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);
goto out;
}
+ if (!len)
+ goto out;
+
#if QUOTA
(void)hfs_getinoquota(cp);
#endif /* QUOTA */
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) {