From e6fdc8caf26d19af3d658467eec973ac1f7a9ab0 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Sat, 15 Aug 2015 07:50:17 +0200 Subject: [PATCH] catch missing device on card closes #3 --- file.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/file.c b/file.c index eee76b9..0c3b2ca 100644 --- a/file.c +++ b/file.c @@ -51,12 +51,11 @@ FILE *pathn(char *mode, char *prefix, UT_string *user, UT_string *device, char * if (device) { ut_lower(device); + utstring_printf(path, "%s/%s/%s/%s", JSONDIR, prefix, utstring_body(user), utstring_body(device)); + } else { + utstring_printf(path, "%s/%s/%s", JSONDIR, prefix, utstring_body(user)); } - //utstring_printf(path, "%s/%s/%-1.1s/%-2.2s", - // JSONDIR, prefix, utstring_body(user), utstring_body(user)); - utstring_printf(path, "%s/%s/%s/%s", JSONDIR, prefix, utstring_body(user), utstring_body(device)); - ut_clean(path); if (mkpath(utstring_body(path)) < 0) {