commit d67511b5bd71cac812727218bc42cc3d23760bc5
parent ea4447f1720d7ef60229bc29b3a0fc12c0d39ccb
Author: Christoph Lohmann <20h@r-36.net>
Date: Thu, 26 Apr 2018 07:16:12 +0200
Make sudo asking more obvious if prompt is given.
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/thinglaunch.c b/thinglaunch.c
@@ -68,6 +68,8 @@ usage(void)
int
main(int argc, char *argv[])
{
+ char promptb[256];
+
if (strstr(argv[0], "thingaskpass")) {
issecret = 1;
tostdout = 1;
@@ -76,10 +78,13 @@ main(int argc, char *argv[])
if (strstr(argv[0], "thingsudoaskpass")) {
issecret = 1;
tostdout = 1;
- if (argc > 1)
- prompt = argv[1];
- else
- prompt = "secret sudo> ";
+ if (argc > 1) {
+ snprintf(promptb, sizeof(promptb),
+ "sudo('%s')> ", argv[1]);
+ prompt = promptb;
+ } else {
+ prompt = "sudo> ";
+ }
argc = 0;
}