summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/.cvsignore1
-rw-r--r--utils/Makefile.am14
-rw-r--r--utils/gdmmkstemp.c32
3 files changed, 44 insertions, 3 deletions
diff --git a/utils/.cvsignore b/utils/.cvsignore
index 005306fe..9e5d14dc 100644
--- a/utils/.cvsignore
+++ b/utils/.cvsignore
@@ -4,3 +4,4 @@ Makefile.in
.deps
gdmaskpass
gdmopen
+gdmmkstemp
diff --git a/utils/Makefile.am b/utils/Makefile.am
index ea97003b..d047fb50 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -20,9 +20,10 @@ INCLUDES = \
$(GNOME_INCLUDEDIR)
sbin_PROGRAMS = \
- @GDMASKPASS@ \
- @GDMOPEN@
-EXTRA_PROGRAMS = gdmaskpass gdmopen
+ @GDMASKPASS@ \
+ @GDMOPEN@ \
+ gdmmkstemp
+EXTRA_PROGRAMS = gdmaskpass gdmopen gdmmkstemp
gdmaskpass_SOURCES = \
gdmaskpass.c
@@ -30,6 +31,9 @@ gdmaskpass_SOURCES = \
gdmopen_SOURCES = \
gdmopen.c
+gdmmkstemp_SOURCES = \
+ gdmmkstemp.c
+
gdmaskpass_LDADD = \
$(GNOME_LIBDIR) \
$(INTLLIBS) \
@@ -39,3 +43,7 @@ gdmaskpass_LDADD = \
gdmopen_LDADD = \
$(GNOME_LIBDIR) \
$(INTLLIBS)
+
+gdmmkstemp_LDADD = \
+ $(GNOME_LIBDIR) \
+ $(INTLLIBS)
diff --git a/utils/gdmmkstemp.c b/utils/gdmmkstemp.c
new file mode 100644
index 00000000..a93c8e01
--- /dev/null
+++ b/utils/gdmmkstemp.c
@@ -0,0 +1,32 @@
+/*
+ * gdmmkstemp.c by the Queen of England
+ * A utility to do mkstemp from a script.
+ *
+ * Copyright (c) 2001 by Queen of England
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+ char template[] = "/tmp/gdm-XXXXXX";
+ int i;
+
+ i = mkstemp (template);
+ if (i < 0)
+ return 1;
+
+ fchown (i, 0600);
+
+ printf ("%s\n", template);
+ close (i)
+ return 0;
+}