diff options
| author | Ciprian Dorin Craciun <ciprian@volution.ro> | 2017-07-19 22:46:03 +0300 |
|---|---|---|
| committer | Ned T. Crigler <crigler@gmail.com> | 2025-06-17 08:15:03 -0700 |
| commit | 1e462729c1bc7325bb1126a674d1fb7b91cf836a (patch) | |
| tree | d5593eecb7dab2468c2b7217b23502ed40b82d34 /main.c | |
| parent | edb19a321c4e15e660426acb68581578a67c5576 (diff) | |
Add support for -- argument termination marker
This allows one to have executables starting with -; another side-effect
of this patch is that in case dtach is used in a script where we can't
trust the user input, now the user is not able to inject new options
that are interpreted by dtach; (for example it is used like dtach -c
socket -- ${@}
(cherry picked from commit ff35a7e791225f8d28a27033658070bbb4caa5ff)
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -152,6 +152,11 @@ main(int argc, char **argv) { char *p; + if (strcmp(argv[0], "--") == 0) { + ++argv; --argc; + break; + } + for (p = argv[0] + 1; *p; ++p) { if (*p == 'E') |
