summaryrefslogtreecommitdiff
path: root/pith/osdep
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2020-06-09 15:08:21 -0600
committerEduardo Chappa <chappa@washington.edu>2020-06-09 15:08:21 -0600
commitffe8da91ab561da34976c82aa5c5780f2925798f (patch)
treebcbc48cb7e627265c31bf71f37b8aad28b1d7e11 /pith/osdep
parent822c94d924415969073cd1dd090a8302ce4e9b4c (diff)
downloadalpine-ffe8da91ab561da34976c82aa5c5780f2925798f.tar.xz
* Fixes in the Windows code for the new external browser capability.
Diffstat (limited to 'pith/osdep')
-rw-r--r--pith/osdep/creatdir.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/pith/osdep/creatdir.c b/pith/osdep/creatdir.c
index 56ee4a75..380e9583 100644
--- a/pith/osdep/creatdir.c
+++ b/pith/osdep/creatdir.c
@@ -90,7 +90,15 @@ create_random_dir(char *dir, size_t len)
/* Some systems need this, on others we don't care if it fails */
our_chown(dir, getuid(), getgid());
#else
- dir = _mktemp(dir);
+ { int i;
+ char *s = &dir[strlen(dir) - 6];
+ for(i = 0; i < 10; i++){
+ sprintf(s, "%x%x%x", (unsigned int)(random() % 256), (unsigned int)(random() % 256),
+ (unsigned int)(random() % 256));
+ if(our_mkdir(dir, 0700) == 0) return dir;
+ }
+ *dir = '\0'; /* if we are here, we failed! */
+ }
#endif /* !_WINDOWS */
return(0);