diff options
author | Kaz Kyheku <kaz@kylheku.com> | 2020-02-05 18:47:53 -0800 |
---|---|---|
committer | Kaz Kyheku <kaz@kylheku.com> | 2020-02-05 18:47:53 -0800 |
commit | ffb07677cc6985997ad96064de3957183bb81997 (patch) | |
tree | 34795879091c50c7fd290698d88685918795b088 /sysif.c | |
parent | 4042efd3e88ad10620e257c25080fd16a228fbf7 (diff) | |
download | txr-ffb07677cc6985997ad96064de3957183bb81997.tar.gz txr-ffb07677cc6985997ad96064de3957183bb81997.tar.bz2 txr-ffb07677cc6985997ad96064de3957183bb81997.zip |
chmod: type error in exception throw.
* sysif.c (chmod_wrap): The uw_throw expression contains an
otal format specifier ~o which requires an integer argument;
but the mode can be a string now. Split into two cases.
Diffstat (limited to 'sysif.c')
-rw-r--r-- | sysif.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -713,8 +713,15 @@ inval: if (err < 0) { int eno = errno; - uw_throwf(errno_to_file_error(eno), lit("~a ~a #o~o: ~d/~s"), - self, target, mode, num(eno), string_utf8(strerror(eno)), nao); + val error = errno_to_file_error(eno); + val errstr = string_utf8(strerror(eno)); + + if (stringp(mode)) + uw_throwf(error, lit("~a ~a ~a: ~d/~s"), + self, target, mode, num(eno), errstr, nao); + else + uw_throwf(error, lit("~a ~a #o~o: ~d/~s"), + self, target, mode, num(eno), errstr, nao); } return t; |