patches/gnomad2-02-2.9.0_p2_mkdtemp.diff
author jurikm
Sun, 12 Feb 2012 14:04:10 +0000
changeset 8245 383896da4129
parent 751 52b9e1fac36a
permissions -rw-r--r--
SFEsauerbraten.spec: add IPS package name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
751
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     1
--- gnomad2-2.9.0-orig/src/Makefile.am	2007-08-23 10:25:11.000000000 +0000
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     2
+++ gnomad2-2.9.0/src/Makefile.am	2007-12-30 10:59:06.085251005 +0000
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     3
@@ -33,7 +33,7 @@
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     4
 		data.c data.h player.c player.h common.h \
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     5
 		metadata.c metadata.h \
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     6
 		wmaread.c wmaread.h \
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     7
-		wavfile.c wavfile.h 
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     8
+		wavfile.c wavfile.h mkdtemp.c
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
     9
 
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    10
 if TAGLIB_COMPILE
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    11
 gnomad2_SOURCES += tagfile.c tagfile.h
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    12
--- /dev/null	2007-12-30 11:06:24.000000000 +0000
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    13
+++ gnomad2-2.9.0/src/mkdtemp.c	2007-12-30 11:06:24.680745636 +0000
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    14
@@ -0,0 +1,67 @@
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    15
+/*
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    16
+ * CDDL HEADER START
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    17
+ *
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    18
+ * The contents of this file are subject to the terms of the
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    19
+ * Common Development and Distribution License (the "License").
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    20
+ * You may not use this file except in compliance with the License.
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    21
+ *
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    22
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    23
+ * or http://www.opensolaris.org/os/licensing.
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    24
+ * See the License for the specific language governing permissions
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    25
+ * and limitations under the License.
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    26
+ *
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    27
+ * When distributing Covered Code, include this CDDL HEADER in each
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    28
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    29
+ * If applicable, add the following below this CDDL HEADER, with the
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    30
+ * fields enclosed by brackets "[]" replaced with your own identifying
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    31
+ * information: Portions Copyright [yyyy] [name of copyright owner]
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    32
+ *
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    33
+ * CDDL HEADER END
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    34
+ */
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    35
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    36
+/*
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    37
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    38
+ * Use is subject to license terms.
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    39
+ */
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    40
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    41
+#pragma ident "%Z%%M% %I%     %E% SMI"
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    42
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    43
+/*
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    44
+ * mkdtemp(3C) - create a directory with a unique name.
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    45
+ */
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    46
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    47
+/* #pragma weak mkdtemp = _mkdtemp */
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    48
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    49
+/* #include "synonyms.h" */
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    50
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    51
+#include <alloca.h>
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    52
+#include <errno.h>
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    53
+#include <stdlib.h>
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    54
+#include <string.h>
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    55
+#include <sys/stat.h>
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    56
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    57
+char *
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    58
+mkdtemp(char *template)
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    59
+{
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    60
+      char *t = alloca(strlen(template) + 1);
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    61
+      char *r;
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    62
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    63
+      /* Save template */
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    64
+      (void) strcpy(t, template);
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    65
+      for (; ; ) {
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    66
+              r = mktemp(template);
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    67
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    68
+              if (*r == '\0')
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    69
+                      return (NULL);
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    70
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    71
+              if (mkdir(template, 0700) == 0)
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    72
+                      return (r);
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    73
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    74
+              /* Other errors indicate persistent conditions. */
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    75
+              if (errno != EEXIST)
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    76
+                      return (NULL);
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    77
+
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    78
+              /* Reset template */
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    79
+              (void) strcpy(template, t);
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    80
+      }
52b9e1fac36a 2007-12-31 Mark Wright <[email protected]>
markwright
parents:
diff changeset
    81
+}