diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | utils/.cvsignore | 1 | ||||
-rw-r--r-- | utils/Makefile.am | 14 | ||||
-rw-r--r-- | utils/gdmmkstemp.c | 32 |
4 files changed, 49 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Wed Oct 24 11:02:55 2001 George Lebl <jirka@5z.com> + + * utils/gdmkstemp.c, utils/Makefile.am: add a small utility + for safely making temp files + Wed Oct 24 01:22:41 2001 George Lebl <jirka@5z.com> * docs/C/gdm.sgml: remove documentation of the VerboseAuth option 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; +} |