Пример #1
0
const char *
spec_to_devname(const char *spec)
{
	if (!spec)
		return NULL;
	if (nocanonicalize || is_pseudo_fs(spec))
		return xstrdup(spec);
	return fsprobe_get_devname_by_spec(spec);
}
Пример #2
0
/* Make a canonical pathname from PATH.  Returns a freshly malloced string.
   It is up the *caller* to ensure that the PATH is sensible.  i.e.
   canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.''
   is not a legal pathname for ``/dev/fd0''.  Anything we cannot parse
   we return unmodified.   */
char *
canonicalize_spec (const char *path)
{
	char *res;

	if (path == NULL)
		return NULL;
	if (is_pseudo_fs(path))
		return xstrdup(path);

	res = canonicalize_path(path);
	if (!res)
		die(EX_SYSERR, _("not enough memory"));
	return res;
}