int rc;
if (!pc) {
- rc = stat(path, sb);
+ rc = path ? stat(path, sb) : -EINVAL;
DBG(CXT, ul_debug("stat '%s' [no context, rc=%d]", path, rc));
} else {
int dir = ul_path_get_dirfd(pc);
rc = fstat(dir, sb); /* dir itself */
if (rc && errno == ENOENT
+ && path
&& pc->redirect_on_enoent
&& pc->redirect_on_enoent(pc, path, &dir) == 0)
rc = fstatat(dir, path, sb, 0);
{
int fd;
+ if (!path)
+ return -EINVAL;
if (!pc) {
fd = open(path, flags);
DBG(CXT, ul_debug("opening '%s' [no context]", path));
{
struct sysfs_blkdev *blk = ul_path_get_dialect(pc);
- if (blk && blk->parent && strncmp(path, "queue/", 6) == 0) {
+ if (blk && blk->parent && path && strncmp(path, "queue/", 6) == 0) {
*dirfd = ul_path_get_dirfd(blk->parent);
if (*dirfd >= 0) {
DBG(CXT, ul_debugobj(pc, "%s redirected to parent", path));