summaryrefslogtreecommitdiffstats
path: root/sysif.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-01-27 06:04:25 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-01-27 06:04:25 -0800
commit558f7e76cc334e85bc30bf5dd9b62fa8038832ef (patch)
tree53beb18f9e9c1b8f451f1c21e5c508a0cfe798ef /sysif.c
parentb21778b7f432c9c5a9c3e5e442b2305cbcc0d524 (diff)
downloadtxr-558f7e76cc334e85bc30bf5dd9b62fa8038832ef.tar.gz
txr-558f7e76cc334e85bc30bf5dd9b62fa8038832ef.tar.bz2
txr-558f7e76cc334e85bc30bf5dd9b62fa8038832ef.zip
ensure-dir: return nil when exists.
* sysif.c (mkdir_nothrow_exists): Return nil in the existence case, when the object is a directory or a symlink to one. * txr.1: Updated.
Diffstat (limited to 'sysif.c')
-rw-r--r--sysif.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sysif.c b/sysif.c
index 369f1890..a12d625f 100644
--- a/sysif.c
+++ b/sysif.c
@@ -339,6 +339,7 @@ static val mkdir_nothrow_exists(val path, val mode)
ret = num(errno);
break;
case EEXIST:
+ ret = nil;
#if HAVE_SYS_STAT
{
struct stat st;
@@ -384,7 +385,7 @@ static val ensure_dir(val path, val mode)
partial_path, sep, pop(&split_path), nao);
}
- if (ret != t) {
+ if (integerp(ret)) {
int eno = c_num(ret);
uw_throwf(errno_to_file_error(eno),
lit("ensure-dir: ~a: ~d/~s"), path, ret,