diff options
author | Stef Walter <stef@thewalter.net> | 2013-07-17 15:53:33 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-07-18 06:53:11 +0200 |
commit | 3f9da410144fd45ee6250dda28cae49300077e29 (patch) | |
tree | c5ea2e0713907958ef1498e93f6547855ff11210 /trust | |
parent | 82738fe7d6143cb25fc1cb201a75b8a071043be8 (diff) |
Fixes for some recent win32 regressions
Diffstat (limited to 'trust')
-rw-r--r-- | trust/save.c | 22 | ||||
-rw-r--r-- | trust/token.c | 10 |
2 files changed, 19 insertions, 13 deletions
diff --git a/trust/save.c b/trust/save.c index acef483..0f047fc 100644 --- a/trust/save.c +++ b/trust/save.c @@ -282,20 +282,18 @@ p11_save_finish_file (p11_save_file *file, if (!path) ret = false; - } else { - if ((file->flags & P11_SAVE_OVERWRITE) && + } else if ((file->flags & P11_SAVE_OVERWRITE) && unlink (path) < 0 && errno != ENOENT) { - p11_message ("couldn't remove original file: %s: %s", - path, strerror (errno)); - ret = false; - } + p11_message ("couldn't remove original file: %s: %s", + path, strerror (errno)); + ret = false; + } - if (ret == true && - rename (file->temp, file->path) < 0) { - p11_message ("couldn't complete writing file: %s: %s", - file->path, strerror (errno)); - ret = false; - } + if (ret == true && + rename (file->temp, path) < 0) { + p11_message ("couldn't complete writing file: %s: %s", + path, strerror (errno)); + ret = false; } unlink (file->temp); diff --git a/trust/token.c b/trust/token.c index c91acd2..12e9e4c 100644 --- a/trust/token.c +++ b/trust/token.c @@ -572,11 +572,15 @@ writer_put_object (p11_save_file *file, static bool mkdir_with_parents (const char *path) { - int mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; char *parent; bool ret; +#ifdef OS_UNIX + int mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; if (mkdir (path, mode) == 0) +#else + if (mkdir (path) == 0) +#endif return true; switch (errno) { @@ -586,7 +590,11 @@ mkdir_with_parents (const char *path) ret = mkdir_with_parents (parent); free (parent); if (ret == true) { +#ifdef OS_UNIX if (mkdir (path, mode) == 0) +#else + if (mkdir (path) == 0) +#endif return true; } } |