about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/archive.hh6
-rw-r--r--src/libutil/hash.hh6
-rw-r--r--src/libutil/immutable.hh5
-rw-r--r--src/libutil/serialise.hh6
-rw-r--r--src/libutil/types.hh6
-rw-r--r--src/libutil/util.cc4
-rw-r--r--src/libutil/util.hh8
-rw-r--r--src/libutil/xml-writer.hh6
8 files changed, 10 insertions, 37 deletions
diff --git a/src/libutil/archive.hh b/src/libutil/archive.hh
index fff62031397c..ccac92074d54 100644
--- a/src/libutil/archive.hh
+++ b/src/libutil/archive.hh
@@ -1,5 +1,4 @@
-#ifndef __ARCHIVE_H
-#define __ARCHIVE_H
+#pragma once
 
 #include "types.hh"
 #include "serialise.hh"
@@ -74,6 +73,3 @@ void restorePath(const Path & path, Source & source);
 
  
 }
-
-
-#endif /* !__ARCHIVE_H */
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh
index e0b6478cc418..781f517428d0 100644
--- a/src/libutil/hash.hh
+++ b/src/libutil/hash.hh
@@ -1,5 +1,4 @@
-#ifndef __HASH_H
-#define __HASH_H
+#pragma once
 
 #include "types.hh"
 #include "serialise.hh"
@@ -109,6 +108,3 @@ public:
 
 
 }
-
-
-#endif /* !__HASH_H */
diff --git a/src/libutil/immutable.hh b/src/libutil/immutable.hh
index 5a42a4610736..8af41900490f 100644
--- a/src/libutil/immutable.hh
+++ b/src/libutil/immutable.hh
@@ -1,5 +1,4 @@
-#ifndef __IMMUTABLE_H
-#define __IMMUTABLE_H
+#pragma once
 
 #include <types.hh>
 
@@ -15,5 +14,3 @@ void makeImmutable(const Path & path);
 void makeMutable(const Path & path);
 
 }
-
-#endif /* !__IMMUTABLE_H */
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index ded4b12a046e..42dd271176db 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -1,5 +1,4 @@
-#ifndef __SERIALISE_H
-#define __SERIALISE_H
+#pragma once
 
 #include "types.hh"
 
@@ -130,6 +129,3 @@ MakeError(SerialisationError, Error)
 
 
 }
-
-
-#endif /* !__SERIALISE_H */
diff --git a/src/libutil/types.hh b/src/libutil/types.hh
index 844ad6f76a13..165a46fa28e9 100644
--- a/src/libutil/types.hh
+++ b/src/libutil/types.hh
@@ -1,5 +1,4 @@
-#ifndef __TYPES_H
-#define __TYPES_H
+#pragma once
 
 #include <string>
 #include <list>
@@ -74,6 +73,3 @@ typedef enum {
 
 
 }
-
-
-#endif /* !__TYPES_H */
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index b188a9fc0e79..689fc543af31 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -380,7 +380,7 @@ static Path tempName(Path tmpRoot, const Path & prefix, bool includePid,
 
 
 Path createTempDir(const Path & tmpRoot, const Path & prefix,
-    bool includePid, bool useGlobalCounter)
+    bool includePid, bool useGlobalCounter, mode_t mode)
 {
     static int globalCounter = 0;
     int localCounter = 0;
@@ -389,7 +389,7 @@ Path createTempDir(const Path & tmpRoot, const Path & prefix,
     while (1) {
         checkInterrupt();
 	Path tmpDir = tempName(tmpRoot, prefix, includePid, counter);
-	if (mkdir(tmpDir.c_str(), 0777) == 0) {
+	if (mkdir(tmpDir.c_str(), mode) == 0) {
 	    /* Explicitly set the group of the directory.  This is to
 	       work around around problems caused by BSD's group
 	       ownership semantics (directories inherit the group of
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index ee0f3862a872..9b8656f70485 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -1,5 +1,4 @@
-#ifndef __UTIL_H
-#define __UTIL_H
+#pragma once
 
 #include "types.hh"
 
@@ -89,7 +88,7 @@ void makePathReadOnly(const Path & path);
 
 /* Create a temporary directory. */
 Path createTempDir(const Path & tmpRoot = "", const Path & prefix = "nix",
-    bool includePid = true, bool useGlobalCounter = true);
+    bool includePid = true, bool useGlobalCounter = true, mode_t mode = 0755);
 
 /* Create a directory and all its parents, if necessary.  Returns the
    list of created directories, in order of creation. */
@@ -333,6 +332,3 @@ void ignoreException();
 
 
 }
-
-
-#endif /* !__UTIL_H */
diff --git a/src/libutil/xml-writer.hh b/src/libutil/xml-writer.hh
index e5cc5f8c5417..fee2eb495eaf 100644
--- a/src/libutil/xml-writer.hh
+++ b/src/libutil/xml-writer.hh
@@ -1,5 +1,4 @@
-#ifndef __XML_WRITER_H
-#define __XML_WRITER_H
+#pragma once
 
 #include <iostream>
 #include <string>
@@ -70,6 +69,3 @@ public:
 
  
 }
-
-
-#endif /* !__XML_WRITER_H */