diff options
| -rw-r--r-- | feh.1 | 2 | ||||
| -rw-r--r-- | src/options.c | 2 | ||||
| -rw-r--r-- | src/support.c | 18 | 
3 files changed, 17 insertions, 5 deletions
| @@ -258,7 +258,7 @@ it, or will fall back to X methods.  Feh stores the commandline necessary to restore  the background you chose in ~/.fehbg. So to have  feh-set backgrounds restored when you restart X, -add the line "eval `cat $HOME/.fehbg`" to your +add the line "`cat $HOME/.fehbg`" to your  X startup script (e.g. ~/.xsession). Note that  you only need to do this for non E window  managers. diff --git a/src/options.c b/src/options.c index 20f4ea6..bb9cf1c 100644 --- a/src/options.c +++ b/src/options.c @@ -985,7 +985,7 @@ show_usage(void)  "                           Feh stores the commandline necessary to restore\n"  "                           the background you chose in ~/.fehbg. So to have\n"  "                           feh-set backgrounds restored when you restart X,\n" -"                           add the line \"eval `cat $HOME/.fehbg`\" to your\n" +"                           add the line \"`cat $HOME/.fehbg`\" to your\n"  "                           X startup script (e.g. ~/.xsession). Note that\n"  "                           you only need to do this for non E window\n"  "                           managers.\n" diff --git a/src/support.c b/src/support.c index 0377e14..ee214cf 100644 --- a/src/support.c +++ b/src/support.c @@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  #include "filelist.h"  #include "options.h"  #include "support.h" +#include <limits.h>  Window ipc_win = None;  Window my_ipc_win = None;  Atom ipc_atom = None; @@ -162,7 +163,7 @@ feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,        /* string for sticking in ~/.fehbg */        char *fehbg = NULL;        char *home; -      char filbuf[4096]; +      char filbuf[PATH_MAX];        /* local display to set closedownmode on */        Display *disp2; @@ -170,11 +171,22 @@ feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,        int depth2;        XGCValues gcvalues;        GC gc; -      int w, h; +      int in, out, w, h;        D(3, ("Falling back to XSetRootWindowPixmap\n")); -      snprintf(filbuf, sizeof(filbuf), "\"%s\"", fil); +      /* Put the filename in filbuf between ' and escape ' in the filename */ +      out = 0; +      filbuf[out++] = '\''; +      for (in = 0; fil[in] && out < (PATH_MAX-4); in++) { +         if (fil[in] == '\'') { +            filbuf[out++] = '\\'; +         } +         filbuf[out++] = fil[in]; +      } +      filbuf[out++] = '\''; +      filbuf[out++] = 0; +              if (scaled) {           w = scr->width;           h = scr->height; | 
