ref: 05bc59f5f19c140a63127bc79c79a3e3b847327c
parent: 7af8d02fe77513cfa3953e670fee38e127e62ad2
author: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
date: Fri Jan 7 05:37:02 EST 2022
cmd/sshfs.c (recvproc): prefer error codes over error strings Strings for existing codes in the most used server (OpenSSH) just repeat the error code name. OTOH we like to have wording of the strings under our control as much as possible, so we can easier find and process them. Error strings are still usefull as fallback for compatibility with future versions of the server.
--- a/sys/src/cmd/sshfs.c
+++ b/sys/src/cmd/sshfs.c
@@ -1144,12 +1144,14 @@
}
r->req->ofcall.count = 0;
e = nil;
- }else if(msgn > 0){
- e = msg;
- e[msgn] = 0;
+ /* prefer our well-defined error strings to arbitrary
+ * strings from the server */
}else if(code < nelem(errors))
e = errors[code];
- else{
+ else if(msgn > 0){
+ e = msg;
+ e[msgn] = 0;
+ }else{
snprint(ebuf, sizeof(ebuf), "error code %d", code);
e = ebuf;
}
--
⑨