diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-05-22 16:01:24 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-04-08 11:09:56 +0200 |
commit | 19bf9ad649ce083f3cf1042e7b6e2be4142e7d74 (patch) | |
tree | 7895aba7e3929bc85a7f917ff16c479d7bcba928 /src/wallpaper.c | |
parent | 685218c5a75a1e7c84e7b5536a527cf92201121b (diff) |
wallpaper.c: Handle missing HOME
Diffstat (limited to 'src/wallpaper.c')
-rw-r--r-- | src/wallpaper.c | 10 |
1 files changed, 10 insertions, 0 deletions
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"); |