From 9812d601c16fb243aac788abfeb9ea01a7870466 Mon Sep 17 00:00:00 2001 From: NRK Date: Wed, 22 Jun 2022 05:05:03 +0200 Subject: r_mkdir: don't truncate the path on error (#322) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit currently, in case of error, r_mkdir will leave the path at a truncated state. a7d39b0ab8 is the commit that introduced this change, and in it the error printing is moved from r_mkdir to the caller, which makes me think it was probably intentional. make it so that the function itself prints the error/warning message and returns the path back to the caller unharmed. Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/322 Reviewed-by: Berke Kocaoğlu Reviewed-by: TAAPArthur --- thumbs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'thumbs.c') diff --git a/thumbs.c b/thumbs.c index 8ca0c58..d6b97ea 100644 --- a/thumbs.c +++ b/thumbs.c @@ -92,10 +92,8 @@ static void tns_cache_write(Imlib_Image im, const char *filepath, bool force) { if ((dirend = strrchr(cfile, '/')) != NULL) { *dirend = '\0'; - if (r_mkdir(cfile) == -1) { - error(0, errno, "%s", cfile); + if (r_mkdir(cfile) < 0) goto end; - } *dirend = '/'; } imlib_context_set_image(im); -- cgit v1.2.3