summaryrefslogtreecommitdiff
path: root/src/core/swap.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-06 20:11:41 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-07 15:42:25 +0200
commit527b7a421ff3927d4f3f170b1b143452e88ae1dc (patch)
treecfb13e123c6dfd547fb005db63a480ca709b46da /src/core/swap.c
parent64f75d7a2898e0c0d2b66f93ddd34ffd345bb3c5 (diff)
util: rework cunescape(), improve error handling
Change cunescape() to return a normal error code, so that we can distuingish OOM errors from parse errors. This also adds a flags parameter to control whether "relaxed" or normal parsing shall be done. If set no parse failures are generated, and the only reason why cunescape() can fail is OOM.
Diffstat (limited to 'src/core/swap.c')
-rw-r--r--src/core/swap.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/core/swap.c b/src/core/swap.c
index 6b1bdb5c1e..53f127484f 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1099,8 +1099,7 @@ static int swap_load_proc_swaps(Manager *m, bool set_flags) {
continue;
}
- d = cunescape(dev);
- if (!d)
+ if (cunescape(dev, UNESCAPE_RELAX, &d) < 0)
return log_oom();
device_found_node(m, d, true, DEVICE_FOUND_SWAP, set_flags);