Commit d026a418 authored by Pavel Emelyanov's avatar Pavel Emelyanov

ext: Lookup by key return NULL or ENOENT

Make it possible to distinguish 'no val' from 'empty val'.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent dd11a50c
#include "common/err.h"
#include "common/list.h"
#include "cr_options.h"
#include "xmalloc.h"
......@@ -36,8 +37,10 @@ char *external_lookup_by_key(char *key)
continue;
if (ext->id[len] == ':')
return ext->id + len + 1;
else if (ext->id[len] == '\0')
return NULL;
}
return NULL;
return ERR_PTR(-ENOENT);
}
int external_for_each_type(char *type, int (*cb)(struct external *, void *), void *arg)
......
......@@ -484,7 +484,7 @@ static int try_resolve_ext_mount(struct mount_info *info)
char *val;
val = external_lookup_by_key(devstr);
if (val) {
if (!IS_ERR_OR_NULL(val)) {
char *source;
int len;
......@@ -1452,7 +1452,7 @@ static char *resolve_source(struct mount_info *mi)
char *val;
val = external_lookup_by_key(mi->source);
if (val)
if (!IS_ERR_OR_NULL(val))
return val;
if (!stat(mi->source, &st) && S_ISBLK(st.st_mode) &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment