diff options
author | Alexander Naumov <alexander_naumov@opensuse.org> | 2016-11-04 14:14:00 +0100 |
---|---|---|
committer | Alexander Naumov <alexander_naumov@opensuse.org> | 2016-11-04 14:14:00 +0100 |
commit | 5460f5d28c01a9a58e021eb1dffef2965e629d58 (patch) | |
tree | afc7a6fc118f44d562bd86907d8d4f72f16eedd0 | |
parent | 3aa5ba0598310278771a791d2c10a1f5ec02258e (diff) | |
download | screen-5460f5d28c01a9a58e021eb1dffef2965e629d58.tar.gz |
adding permissions check for the logfile name
Screen shows error message and terminates if you
specify not available (permissions problem?) logfile
name (-L parameter).
bug #49491
Signed-off-by: Alexander Naumov <alexander_naumov@opensuse.org>
-rw-r--r-- | src/screen.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c index 97bf85c..97c2597 100644 --- a/src/screen.c +++ b/src/screen.c @@ -670,6 +670,12 @@ int main(int ac, char** av) Panic(0, "-L: logfile name can not start with \"-\" symbol"); if (strlen(screenlogfile) > PATH_MAX) Panic(0, "-L: logfile name too long. (max. %d char)", PATH_MAX); + + FILE *w_check; + if ((w_check = fopen(screenlogfile, "w")) == NULL) + Panic(0, "-L: logfile name access problem"); + else + fclose(w_check); } nwin_options.Lflag = 1; break; |