summaryrefslogtreecommitdiff
path: root/dbm
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2001-06-22 06:33:34 +0000
committerwtc%netscape.com <devnull@localhost>2001-06-22 06:33:34 +0000
commit200819b21c3a2ef49c12cb51a2225d5f34f2e2d5 (patch)
tree4571e0bf780c66461166af73c9fe576b8a8c0179 /dbm
parent4725a54d0cb00fdffd91606a7413de0299e1b873 (diff)
downloadnss-hg-200819b21c3a2ef49c12cb51a2225d5f34f2e2d5.tar.gz
Bugzilla bug #72014: fixed DBM temporary file problems on OS/2. Thanks
to Javier Pedemonte <pedemont@us.ibm.com> for the patch. r=relyea,wtc. sr=blizzard. a=asa@mozilla.org for the trunk and mozilla0.9.2. Modified files: h_page.c mktemp.c
Diffstat (limited to 'dbm')
-rw-r--r--dbm/src/h_page.c12
-rw-r--r--dbm/src/mktemp.c6
2 files changed, 14 insertions, 4 deletions
diff --git a/dbm/src/h_page.c b/dbm/src/h_page.c
index 79f31477d..2c4b50f87 100644
--- a/dbm/src/h_page.c
+++ b/dbm/src/h_page.c
@@ -1159,7 +1159,10 @@ __free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
static int
open_temp(HTAB *hashp)
{
-#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2)
+#ifdef XP_OS2
+ hashp->fp = mkstemp(NULL);
+#else
+#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh)
sigset_t set, oset;
#endif
char * tmpdir;
@@ -1168,7 +1171,7 @@ open_temp(HTAB *hashp)
char filename[1024];
char last;
-#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2)
+#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh)
/* Block signals; make sure file goes away at process exit. */
(void)sigfillset(&set);
(void)sigprocmask(SIG_BLOCK, &set, &oset);
@@ -1205,15 +1208,16 @@ open_temp(HTAB *hashp)
#else
if ((hashp->fp = mkstemp(filename)) != -1) {
(void)unlink(filename);
-#if !defined(macintosh) && !defined(XP_OS2)
+#if !defined(macintosh)
(void)fcntl(hashp->fp, F_SETFD, 1);
#endif
}
#endif
-#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2)
+#if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh)
(void)sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
#endif
+#endif /* !OS2 */
return (hashp->fp != -1 ? 0 : -1);
}
diff --git a/dbm/src/mktemp.c b/dbm/src/mktemp.c
index 4da6c9497..574eb9fe5 100644
--- a/dbm/src/mktemp.c
+++ b/dbm/src/mktemp.c
@@ -69,9 +69,15 @@ static int _gettemp(char *path, register int *doopen, int extraFlags);
int
mkstemp(char *path)
{
+#ifdef XP_OS2
+ FILE *temp = tmpfile();
+
+ return (temp ? fileno(temp) : -1);
+#else
int fd;
return (_gettemp(path, &fd, 0) ? fd : -1);
+#endif
}
int