~ubuntu-branches/ubuntu/hardy/logrotate/hardy-updates

« back to all changes in this revision

Viewing changes to debian/patches/rh-noTMPDIR.patch

  • Committer: Bazaar Package Importer
  • Author(s): Paul Martin
  • Date: 2006-04-08 23:02:19 UTC
  • mfrom: (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20060408230219-7moi9qw2g42w1nye
Tags: 3.7.1-3
* Patch debian/control to fix FTBFS on kfreebsd-amd64. Perhaps we need
  a build-depends macro for !kfreebsd. (Closes: #361465)
* Use and depend on debhelper version 5.
* Switch from dpatch to quilt.
* cpp-crossbuild.patch: change from using $(CPP) to $(CC) -E.
  Thanks to NIIBE Yutaka. (Closes: #284040)
* dst.patch: fix mktime initialisation so that daylight savings is
  taken into account. Thanks to Holger Weiss. (Closes: #278591)
* man-333996.patch: fix typos in logrotate.8 where "then" should be
  "than". Thanks to Adrian Knoth. (Closes: #333996)
* manpage.patch: Apply missed fixes from #101272. Thanks to J S Bygott.
  (Closes: #335060)
* script-argument.patch: Allow the use of $1 in scripts again.
  (Closes: #330783)
* README.Debian: Document that sysklogd does its own log rotation.
  (Closes: #308963)
* README.Debian: Document how scripts are called. (Closes: #308920)
* Update the copyright file.
* debian/control: remove versioned dependency on cron. The version of
  cron forbidden pre-dates woody (currently "oldstable") by several
  years. This versioned dependency is preventing logrotate being
  installed with bcron. (Closes: #304038, #349150)
* debian/rules: Fix backports, allowing them to use selinux.
  (Closes: #340363)
* uncompressChild-warning.patch: Fix a "might be used uninitialised" 
  warning from gcc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Do not use tmpfile to run script anymore (Closes: #149270)
 
2
From RedHat patches.
 
3
 
 
4
Index: logrotate-3.7.1/logrotate.c
 
5
===================================================================
 
6
--- logrotate-3.7.1.orig/logrotate.c    2006-04-08 20:38:58.314755223 +0100
 
7
+++ logrotate-3.7.1/logrotate.c 2006-04-08 20:42:11.628324134 +0100
 
8
@@ -88,10 +88,7 @@
 
9
 }
 
10
 
 
11
 static int runScript(char * logfn, char * script) {
 
12
-    int fd;
 
13
-    char *filespec;
 
14
     int rc;
 
15
-    char buf[256];
 
16
 
 
17
     if (debug) {
 
18
        message(MESS_DEBUG, "running script with arg %s: \"%s\"\n", 
 
19
@@ -99,38 +96,12 @@
 
20
        return 0;
 
21
     }
 
22
 
 
23
-    filespec = buf;
 
24
-    snprintf(buf, sizeof(buf), "%s/logrotate.XXXXXX", getenv("TMPDIR") ?: "/tmp");
 
25
-    fd = -1;
 
26
-    if (!filespec || (fd = mkstemp(filespec)) < 0 || fchmod(fd, 0700)) {
 
27
-       message(MESS_DEBUG, "error creating %s: %s\n", filespec,
 
28
-               strerror(errno));
 
29
-       if (fd >= 0) {
 
30
-           close(fd);
 
31
-           unlink(filespec);
 
32
-       }
 
33
-       return -1;
 
34
-    }
 
35
-
 
36
-    if (write(fd, "#!/bin/sh\n\n", 11) != 11 ||
 
37
-       write(fd, script, strlen(script)) != strlen(script)) {
 
38
-       message(MESS_DEBUG, "error writing %s\n", filespec);
 
39
-       close(fd);
 
40
-       unlink(filespec);
 
41
-       return -1;
 
42
-    }
 
43
-
 
44
-    close(fd);
 
45
-
 
46
     if (!fork()) {
 
47
-       execlp(filespec, filespec, logfn, NULL);
 
48
+       execl("/bin/sh", "sh", "-c", script, NULL);
 
49
        exit(1);
 
50
     }
 
51
 
 
52
     wait(&rc);
 
53
-
 
54
-    unlink(filespec);
 
55
-
 
56
     return rc;
 
57
 }
 
58