From 97fec642e591762391e6d453874ff9b5c9ba0c1e Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Mon, 26 Dec 2016 12:15:35 -0600 Subject: [PATCH] afsd_kernel: remove gratuitous OS dependence Commit 94c15f62 in 2010 gave NetBSD and only NetBSD the debug printing of errno and the strerror() output, with no justification in the commit message. In the interest of unifying behavior and avoiding unnecessary OS dependence, give all platforms the errno and strerror() behavior. [mmeffie@sinenomine.net: print errno iff syscall returns -1.] Change-Id: If3c4e0ded54bbd4d5c2573f7d7ee1c82ee3e7223 Reviewed-on: https://gerrit.openafs.org/12500 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/afsd/afsd_kernel.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/afsd/afsd_kernel.c b/src/afsd/afsd_kernel.c index cc4c02b..b15df74 100644 --- a/src/afsd/afsd_kernel.c +++ b/src/afsd/afsd_kernel.c @@ -274,14 +274,14 @@ afsd_call_syscall(struct afsd_syscall_args *args) error = os_syscall(args); if (afsd_debug) { -#ifdef AFS_NBSD40_ENV - char *s = strerror(errno); - printf("SScall(%d, %d, %d)=%d (%d, %s)\n", AFS_SYSCALL, AFSCALL_CALL, - (int)args->params[0], error, errno, s); -#else - printf("SScall(%d, %d, %d)=%d\n", AFS_SYSCALL, AFSCALL_CALL, - (int)args->params[0], error); -#endif + if (error == -1) { + char *s = strerror(errno); + printf("SScall(%d, %d, %d)=%d (%d, %s)\n", AFS_SYSCALL, AFSCALL_CALL, + (int)args->params[0], error, errno, s); + } else { + printf("SScall(%d, %d, %d)=%d\n", AFS_SYSCALL, AFSCALL_CALL, + (int)args->params[0], error); + } } return error; -- 1.9.4