File httpd-2.x.x-logresolve.patch of Package apache2 (Revision ede55ee8d62ba2344369dafb45ec00cd)
Currently displaying revision ede55ee8d62ba2344369dafb45ec00cd , Show latest
57
1
--- httpd-2.4.6.orig/support/logresolve.pl.in
2
+++ httpd-2.4.6/support/logresolve.pl.in
3
4
5
use FileHandle;
6
use Socket;
7
+use File::Temp;
8
9
use strict;
10
no strict 'refs';
11
12
my %hash = ();
13
my $parent = $$;
14
15
+my $tempdir = File::Temp::tempdir("logresolve.pl.sockets.XXXXXX", CLEANUP => 1);
16
+
17
my @children = ();
18
for (my $child = 1; $child <=$CHILDREN; $child++) {
19
my $f = fork();
20
if (!$f) {
21
- $filename = "./.socket.$parent.$child";
22
+ $filename = "$tempdir/socket.$parent.$child";
23
if (-e $filename) { unlink($filename) || warn "$filename .. $!\n";}
24
&child($child);
25
exit(0);
26
27
# die kiddies, die
28
kill(15, @children);
29
for (my $child = 1; $child <=$CHILDREN; $child++) {
30
- if (-e "./.socket.$parent.$child") {
31
- unlink("./.socket.$parent.$child")
32
- || warn ".socket.$parent.$child $!";
33
+ if (-e "$tempdir/socket.$parent.$child") {
34
+ unlink("$tempdir/socket.$parent.$child")
35
+ || warn "$tempdir/socket.$parent.$child $!";
36
}
37
}
38
}
39
40
if (!socket($CHILDSOCK{$child}, AF_UNIX, SOCK_STREAM, $PROTOCOL)) {
41
warn "parent socket to child failed $!";
42
}
43
- $filename = "./.socket.$parent.$child";
44
+ $filename = "$tempdir/socket.$parent.$child";
45
my $response;
46
do {
47
$response = connect($CHILDSOCK{$child}, sockaddr_un($filename));
48
49
# create a socket to communicate with parent
50
socket(INBOUND, AF_UNIX, SOCK_STREAM, $PROTOCOL)
51
|| die "Error with Socket: !$\n";
52
- $filename = "./.socket.$parent.$me";
53
+ $filename = "$tempdir/socket.$parent.$me";
54
bind(INBOUND, sockaddr_un($filename))
55
|| die "Error Binding $filename: $!\n";
56
listen(INBOUND, 5) || die "Error Listening: $!\n";
57