From 08d66239fa7fd434c9774d2ab8b899d2511fef16 Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Tue, 8 Mar 2022 16:42:43 +0100 Subject: [PATCH] Reduce memory access in runprog Previously, we used a for loop to rearrange argv to omit the first argument, the rdo call itself. It's way smarter to just dereference the first argv argument, and use it as an argv pointer, to achieve the same result. --- rdo.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/rdo.c b/rdo.c index 8bbb9e4..0937f82 100644 --- a/rdo.c +++ b/rdo.c @@ -33,19 +33,16 @@ void getconf(FILE* fp, const char* entry, char* result, size_t len_result) { errx(1, "Could not get '%s' entry in config", entry); } -int runprog(int argc, char** argv) { - for(int i=0; isp_pwdp, hashed_pw) == 0) { setsession(getppid(), ts_ttl); - return runprog(argc, argv); + runprog(&argv[1]); } usleep(sleep_ms);