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 <buildbot@rampaginggeek.com>
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Ben Huntsman 2024-12-27 12:11:47 -08:00 committed by Andrew Deason
parent e4d8329619
commit 3b605e621f
2 changed files with 14 additions and 2 deletions

View File

@ -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);
}

View File

@ -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);
}