+2005-05-29 Corinna Vinschen <corinna@vinschen.de>
+
+ * path.cc (path_conv::check): Move component to function scope. Set
+ PATH_RO only on *real* FH_NETDRIVEs or on non-FH_NETDRIVE virtual
+ paths. Allow non-retrievable shares to be handled as files.
+
2005-05-29 Eric Blake <ebb9@byu.net>
* include/limits.h (LLONG_MIN, LLONG_MAX, ULLONG_MAX): Always define.
memset (&dev, 0, sizeof (dev));
fs.clear ();
normalized_path = NULL;
+ int component = 0; // Number of translated components
if (!(opt & PC_NULLEMPTY))
error = 0;
Also: be careful to preserve the errno returned from
symlink.check as the caller may need it. */
/* FIXME: Do we have to worry about multiple \'s here? */
- int component = 0; // Number of translated components
+ component = 0; // Number of translated components
sym.contents[0] = '\0';
int symlen = 0;
fileattr = INVALID_FILE_ATTRIBUTES;
goto virtual_component_retry;
}
- path_flags |= PATH_RO;
+ if (component == 0 || dev.devn != FH_NETDRIVE)
+ path_flags |= PATH_RO;
goto out;
}
/* devn should not be a device. If it is, then stop parsing now. */
}
else if (isvirtual_dev (dev.devn) && fileattr == INVALID_FILE_ATTRIBUTES)
{
- error = dev.devn == FH_NETDRIVE ? ENOSHARE : ENOENT;
- return;
+ if (dev.devn == FH_NETDRIVE && component)
+ {
+ /* This case indicates a non-existant resp. a non-retrievable
+ share. This happens for instance if the share is a printer.
+ In this case the path must not be treated like a FH_NETDRIVE,
+ but like a FH_FS instead, so the usual open call for files
+ is used on it. */
+ dev.parse (FH_FS);
+ }
+ else
+ {
+ error = dev.devn == FH_NETDRIVE ? ENOSHARE : ENOENT;
+ return;
+ }
}
else if (!need_directory || error)
/* nothing to do */;