diff --git a/recorder.c b/recorder.c index 77680fd..a9277fb 100644 --- a/recorder.c +++ b/recorder.c @@ -92,7 +92,7 @@ int do_info(void *userdata, UT_string *username, UT_string *device, JsonNode *js /* I know the payload is valid JSON: write card */ - if ((fp = pathn("wb", "cards", username, NULL, "json", time(0))) != NULL) { + if ((fp = pathn("wb", "cards", username, device, "json", time(0))) != NULL) { char *js = json_stringify(json, NULL); if (js) { fprintf(fp, "%s\n", js); @@ -124,7 +124,7 @@ int do_info(void *userdata, UT_string *username, UT_string *device, JsonNode *js /* We have a base64-encoded "face". Decode it and store binary image */ if ((img = base64_decode(UB(face), &imglen)) != NULL) { - if ((fp = pathn("wb", "photos", username, NULL, "png", time(0))) != NULL) { + if ((fp = pathn("wb", "photos", username, device, "png", time(0))) != NULL) { fwrite(img, sizeof(char), imglen, fp); fclose(fp); } diff --git a/util.c b/util.c index f51e3c3..2eff7c2 100644 --- a/util.c +++ b/util.c @@ -490,22 +490,10 @@ FILE *pathn(char *mode, char *prefix, UT_string *user, UT_string *device, char * return (NULL); } - -#if 0 - if (device) { - utstring_printf(path, "/%s-%s.%s", - UB(user), UB(device), suffix); - } else { - utstring_printf(path, "/%s.%s", - UB(user), suffix); - } -#endif - if (strcmp(prefix, "rec") == 0) { utstring_printf(path, "/%s.%s", yyyymm(epoch), suffix); } else { - utstring_printf(path, "/%s.%s", - UB(user), suffix); + utstring_printf(path, "/%s-%s.%s", UB(user), UB(device), suffix); } ut_clean(path);