From 527b7a421ff3927d4f3f170b1b143452e88ae1dc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 6 Apr 2015 20:11:41 +0200 Subject: 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. --- src/core/swap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/swap.c') 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); -- cgit v1.2.3-54-g00ecf