]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afsd_kernel: remove gratuitous OS dependence
authorBenjamin Kaduk <kaduk@mit.edu>
Mon, 26 Dec 2016 18:15:35 +0000 (12:15 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 3 Jan 2017 05:36:05 +0000 (00:36 -0500)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afsd/afsd_kernel.c

index cc4c02bb0a476b6dafabdade38c2cb9267690c48..b15df7476cb95314ad1dfaf90141117027a45fc0 100644 (file)
@@ -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;