summaryrefslogtreecommitdiffstats
path: root/sal/osl/unx/tempfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl/unx/tempfile.c')
-rw-r--r--sal/osl/unx/tempfile.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c
index e10fffaa5ce2..4e5abae826a2 100644
--- a/sal/osl/unx/tempfile.c
+++ b/sal/osl/unx/tempfile.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,6 +31,9 @@
/*****************************************************************/
#include <stdio.h>
+#if defined(NETBSD)
+#include <paths.h>
+#endif
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -39,6 +43,7 @@
#include <osl/thread.h>
#include <rtl/ustrbuf.h>
#include <osl/diagnose.h>
+#include <sal/macros.h>
#ifndef _FILE_URL_H_
#include "file_url.h"
@@ -63,13 +68,18 @@ oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir )
const char *pValue = getenv( "TEMP" );
if ( !pValue )
- {
pValue = getenv( "TMP" );
-#if defined(SOLARIS) || defined (LINUX) || defined (FREEBSD)
- if ( !pValue )
- pValue = P_tmpdir;
+
+#if defined(NETBSD)
+ if ( !pValue )
+ pValue = _PATH_TMP;
+#else
+ if ( !pValue )
+ pValue = P_tmpdir;
#endif
- }
+
+ if ( !pValue )
+ pValue = "/tmp";
#endif /* MACOSX */
if ( pValue )
@@ -98,7 +108,7 @@ oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir )
******************************************************************/
static const char LETTERS[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
-static const int COUNT_OF_LETTERS = sizeof(LETTERS)/sizeof(LETTERS[0]) - 1;
+static const int COUNT_OF_LETTERS = SAL_N_ELEMENTS(LETTERS) - 1;
#define RAND_NAME_LENGTH 6
@@ -368,3 +378,5 @@ oslFileError SAL_CALL osl_createTempFile(
return osl_error;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */