From: Andrei Tatar Date: Wed, 19 Feb 2025 11:54:31 +0000 (+0100) Subject: lib/posix-fdtab: Fix wrong return in exec handler X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=45e6f08ef4eb850e261259c51691e00543390dc0;p=unikraft%2Funikraft.git lib/posix-fdtab: Fix wrong return in exec handler Previously fdtab_handle_execve would return 0 on success, as per common convention. This is however wrong for event handlers, as these require specific exit codes on success; in this case UK_EVENT_HANDLED_CONT. This change fixes this oversight. Signed-off-by: Andrei Tatar Approved-by: Michalis Pappas Reviewed-by: Michalis Pappas GitHub-Closes: #1278 --- diff --git a/lib/posix-fdtab/fdtab.c b/lib/posix-fdtab/fdtab.c index f78fd7ed8..607ea240d 100644 --- a/lib/posix-fdtab/fdtab.c +++ b/lib/posix-fdtab/fdtab.c @@ -392,13 +392,13 @@ void uk_fdtab_cloexec(void) fdtab_cleanup(active_fdtab, 0); } +#if CONFIG_LIBPOSIX_PROCESS_EXECVE static int fdtab_handle_execve(void *data __unused) { uk_fdtab_cloexec(); - return 0; + return UK_EVENT_HANDLED_CONT; } -#if CONFIG_LIBPOSIX_PROCESS_EXECVE UK_EVENT_HANDLER_PRIO(POSIX_PROCESS_EXECVE_EVENT, fdtab_handle_execve, UK_PRIO_EARLIEST); #endif /* CONFIG_LIBPOSIX_PROCESS_EXECVE */