summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-02-05 18:08:37 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2010-02-05 18:08:37 +0100
commit4323b10ab754066f6e4e16b7338ad26e7479391d (patch)
treea67e8eeead92cd26f67c61274d9015fdd537d0fd
parenta4d4d67498d168eefdfbba694b99616f60862d77 (diff)
Apply 04_escape_filenamed.patch from Debian
-rw-r--r--feh.12
-rw-r--r--src/options.c2
-rw-r--r--src/support.c18
3 files changed, 17 insertions, 5 deletions
diff --git a/feh.1 b/feh.1
index 56b879e..8d8b845 100644
--- a/feh.1
+++ b/feh.1
@@ -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;