summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBenjamin Riefenstahl <b.riefenstahl@turtle-trading.net>2022-01-07 10:37:02 +0000
committerOri Bernstein <ori@eigenstate.org>2022-01-07 10:37:02 +0000
commit108d74cb0a8d27e82550d2772ae64fd7748e151d (patch)
treeb7ae8e0cfac894f052da2c269a65ffe0cb60c900 /sys
parent9d43029ff984435111eff658308a44b4f3eee1cc (diff)
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/src/cmd/sshfs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/src/cmd/sshfs.c b/sys/src/cmd/sshfs.c
index e0c0b1422..ade388f39 100644
--- a/sys/src/cmd/sshfs.c
+++ b/sys/src/cmd/sshfs.c
@@ -1144,12 +1144,14 @@ recvproc(void *)
}
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;
}