From 3b605e621fee7403f20722d0c9b9f742ee998515 Mon Sep 17 00:00:00 2001 From: Ben Huntsman Date: Fri, 27 Dec 2024 12:11:47 -0800 Subject: [PATCH] export: Call execerror as /usr/sbin/execerror On AIX, there are two kernel extensions, and each is loaded by a utility in src/export, cfgexport, and cfgafs. This utility calls the AIX "sysconfig" system call to load the extension into the kernel. Historically this usually works so error messages are not often seen, though the programs have facilities to display error messages. Error messages from the loading of kernel extensions are displayed using the execerror utility. Beginning with AIX 4.2, this utility was moved from /etc/execerror to /usr/sbin. The AFS cfg utlities were never updated. If an error occurs during loading of one of the extensions, the user receives the following misleading error: SYS_KLOAD: No such file or directory This error is not actually the result of the failed extension load, but actually the result of the next source code line: perror("SYS_KLOAD"); This error is actually a statement that the utility cannot find execerror. Update the utilities to call execerror from the correct location starting with AIX 4.2. Change-Id: I91bf7d93c35d536c9b3ad0f97f02c5a0289cbf63 Reviewed-on: https://gerrit.openafs.org/16006 Tested-by: BuildBot Reviewed-by: Ben Huntsman Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason --- src/export/cfgafs.c | 8 +++++++- src/export/cfgexport.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/export/cfgafs.c b/src/export/cfgafs.c index 6f1892344f..ca4d5a293e 100644 --- a/src/export/cfgafs.c +++ b/src/export/cfgafs.c @@ -33,6 +33,12 @@ extern int sysconfig(int cmd, void *arg, int len); #include "AFS_component_version_number.c" +#if defined(AFS_AIX42_ENV) +static const char *execerror = "/usr/sbin/execerror"; +#else +static const char *execerror = "/etc/execerror"; +#endif + static void usage(void) { @@ -105,7 +111,7 @@ main(int argc, char **argv) if (res != 0) { perror("SYS_KLOAD"); loadquery(L_GETMESSAGES, &buf[2], sizeof buf - 8); - execvp("/etc/execerror", buf); + execvp(execerror, buf); exit(1); } diff --git a/src/export/cfgexport.c b/src/export/cfgexport.c index 04eecb445c..f8f3df20ce 100644 --- a/src/export/cfgexport.c +++ b/src/export/cfgexport.c @@ -48,6 +48,12 @@ static void dump_ksym(sym_t *ksp, char *strings); static void error(); static void sys_error(); +#if defined(AFS_AIX42_ENV) +static const char *execerror = "/usr/sbin/execerror"; +#else +static const char *execerror = "/etc/execerror"; +#endif + static void usage(void) { @@ -126,7 +132,7 @@ main(int argc, char **argv) cload.path = file; if (sysconfig(SYS_KLOAD, &cload, sizeof(cload)) == -1) { loadquery(L_GETMESSAGES, &buf[2], sizeof buf - 8); - execvp("/etc/execerror", buf); + execvp(execerror, buf); perror("SYS_KLOAD"); exit(1); }