From 717f2a00b002b0bf17f874f8d542a22175b9ad2f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 22 May 2014 16:01:24 +0200 Subject: wallpaper.c: Handle missing HOME --- src/wallpaper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wallpaper.c b/src/wallpaper.c index 02c0549..6e629dc 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -228,9 +228,19 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, char bgfil[4096]; char sendbuf[4096]; + /* + * TODO this re-implements mkstemp (badly). However, it is only needed + * for non-file images and enlightenment. Might be easier to just remove + * it. + */ + snprintf(bgname, sizeof(bgname), "FEHBG_%d", num); if (!fil && im) { + if (getenv("HOME") == NULL) { + weprintf("Cannot save wallpaper to temporary file: You have no HOME"); + return; + } snprintf(bgfil, sizeof(bgfil), "%s/.%s.png", getenv("HOME"), bgname); imlib_context_set_image(im); imlib_image_set_format("png"); -- cgit v1.2.3