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/import/pull-common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/import/pull-common.c') diff --git a/src/import/pull-common.c b/src/import/pull-common.c index efd67a2937..57323531e2 100644 --- a/src/import/pull-common.c +++ b/src/import/pull-common.c @@ -92,9 +92,9 @@ int pull_find_old_etags(const char *url, const char *image_root, int dt, const c if (a >= b) continue; - u = cunescape_length(a, b - a); - if (!u) - return -ENOMEM; + r = cunescape_length(a, b - a, 0, &u); + if (r < 0) + return r; if (!http_etag_is_valid(u)) { free(u); -- cgit v1.2.3-54-g00ecf