diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2018-05-21 16:00:55 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2018-05-21 16:00:55 +0000 |
commit | 6ef6e64387de4da1a1eec1e3d1f99d1d11907651 (patch) | |
tree | 37f5a48788f1583b2c1c0e78fc9a9ae479fcb23e /app/twm/src/menus.c | |
parent | 91e696fb83c9c4682c87589713c0230e92545a5c (diff) |
Update to twm 1.0.10
Diffstat (limited to 'app/twm/src/menus.c')
-rw-r--r-- | app/twm/src/menus.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/app/twm/src/menus.c b/app/twm/src/menus.c index a39044497..8aa99c7ec 100644 --- a/app/twm/src/menus.c +++ b/app/twm/src/menus.c @@ -2020,7 +2020,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, "%s: unable to open cut file \"%s\"\n", ProgramName, tmp); } - if (ptr != tmp) free (ptr); + free (ptr); } } else { XFree(ptr); @@ -2171,21 +2171,25 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, case F_FILE: ptr = ExpandFilename(action); - fd = open(ptr, O_RDONLY); - if (fd >= 0) - { - count = read(fd, buff, MAX_FILE_SIZE - 1); - if (count > 0) - XStoreBytes(dpy, buff, count); + if (ptr) { + fd = open(ptr, O_RDONLY); + if (fd >= 0) + { + count = read(fd, buff, MAX_FILE_SIZE - 1); + if (count > 0) + XStoreBytes(dpy, buff, count); - close(fd); - } - else - { - fprintf (stderr, "%s: unable to open file \"%s\"\n", - ProgramName, ptr); + close(fd); + } + else + { + fprintf (stderr, "%s: unable to open file \"%s\"\n", + ProgramName, ptr); + } + free(ptr); + } else { + fprintf (stderr, "%s: error expanding filename\n", ProgramName); } - if (ptr != action) free(ptr); break; case F_REFRESH: |