Skip to content

Commit

Permalink
Allow relative paths for -l option as well
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Mar 22, 2024
1 parent 1558386 commit 80f0bb5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions unix/vncserver/vncsession.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ static void
usage(void)
{
fprintf(stderr, "Syntax:\n");
fprintf(stderr, " vncsession [-D] [-l /path/to/log/dir] <username> <display>\n");
fprintf(stderr, " vncsession [-D] [-l path/to/log/dir] <username> <display>\n");
exit(EX_USAGE);
}

Expand All @@ -539,10 +539,7 @@ main(int argc, char **argv)
forking = 0;
break;
case 'l':
if (optarg[0] == '/')
snprintf(logfile, sizeof(logfile), "%s", optarg);
else
fprintf(stderr, "Option -l passed with non-absolute path, will be ignored.");
snprintf(logfile, sizeof(logfile), optarg[0] == '/' ? "%s" : "./%s", optarg);
break;
default:
usage();
Expand Down

0 comments on commit 80f0bb5

Please sign in to comment.