Annotation of /trunk/dhcpcd/patches/dhcpcd-1.3.22-pl4-fhs.patch
Parent Directory | Revision Log
Revision 144 -
(hide annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 6007 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 6007 byte(s)
-import
1 | niro | 144 | Submitted By: BLFS Book <blfs-book@linuxfromscratch.org> |
2 | Date: 2003-10-04 | ||
3 | Initial Package Version: 1.3.22-pl4 | ||
4 | Origin: BLFS Book | ||
5 | Description: Dhcpcd unpatched puts all configuration and temporary files in | ||
6 | /etc/dhcpc. This becomes very annoying when dhcpcd tells you it's running | ||
7 | and it's not. You look in /var/run for the PID file, but it's not there, | ||
8 | the PID file that needs deleting is in /etc/dhcpc. This patch brings this | ||
9 | program into FHS compliance, but more importantly, puts | ||
10 | files where you expect them to be. | ||
11 | diff -Naur dhcpcd-1.3.22-pl4/cache.c dhcpcd-1.3.22-pl4-patched/cache.c | ||
12 | --- dhcpcd-1.3.22-pl4/cache.c 2002-12-31 03:31:08.000000000 +0100 | ||
13 | +++ dhcpcd-1.3.22-pl4-patched/cache.c 2003-01-19 15:33:57.000000000 +0100 | ||
14 | @@ -41,7 +41,7 @@ | ||
15 | int readDhcpCache() | ||
16 | { | ||
17 | int i,o; | ||
18 | - snprintf(cache_file,sizeof(cache_file),DHCP_CACHE_FILE,ConfigDir,IfNameExt); | ||
19 | + snprintf(cache_file,sizeof(cache_file),DHCP_CACHE_FILE,CACHE_DIR,IfNameExt); | ||
20 | i=open(cache_file,O_RDONLY); | ||
21 | if ( i == -1 ) return -1; | ||
22 | o=read(i,(char *)&DhcpIface,sizeof(dhcpInterface)); | ||
23 | @@ -54,6 +54,6 @@ | ||
24 | /*****************************************************************************/ | ||
25 | void deleteDhcpCache() | ||
26 | { | ||
27 | - snprintf(cache_file,sizeof(cache_file),DHCP_CACHE_FILE,ConfigDir,IfNameExt); | ||
28 | + snprintf(cache_file,sizeof(cache_file),DHCP_CACHE_FILE,CACHE_DIR,IfNameExt); | ||
29 | unlink(cache_file); | ||
30 | } | ||
31 | diff -Naur dhcpcd-1.3.22-pl4/dhcpcd.8 dhcpcd-1.3.22-pl4-patched/dhcpcd.8 | ||
32 | --- dhcpcd-1.3.22-pl4/dhcpcd.8 2003-01-01 02:31:31.000000000 +0100 | ||
33 | +++ dhcpcd-1.3.22-pl4-patched/dhcpcd.8 2003-01-19 15:25:03.000000000 +0100 | ||
34 | @@ -137,7 +137,7 @@ | ||
35 | will use | ||
36 | .I <ConfigDir> | ||
37 | directory instead of default | ||
38 | -.I /etc/dhcpc | ||
39 | +.I /var/lib/dhcpc | ||
40 | to store configuration information. | ||
41 | .TP | ||
42 | .BI \-S | ||
43 | @@ -177,7 +177,7 @@ | ||
44 | write the | ||
45 | .I <ConfigDir>/dhcpcd-<interface>.info | ||
46 | and | ||
47 | -.I <ConfigDir>/dhcpcd-<interface>.cache | ||
48 | +.I /var/cache/dhcpcd-<interface>.cache | ||
49 | files and it does attempt to execute | ||
50 | .I <ConfigDir>/dhcpcd.exe | ||
51 | script. The pathname of | ||
52 | @@ -258,7 +258,7 @@ | ||
53 | to the interface | ||
54 | .B dhcpcd | ||
55 | will use previously obtained IP address stored in | ||
56 | -.I <ConfigDir>/dhcpcd-<interface>.cache | ||
57 | +.I /var/cache/dhcpcd-<interface>.cache | ||
58 | file. | ||
59 | .TP | ||
60 | .BI \-G \ [gateway] | ||
61 | @@ -281,7 +281,7 @@ | ||
62 | .SH FILES | ||
63 | .PD 0 | ||
64 | .TP | ||
65 | -.BI /etc/dhcpc | ||
66 | +.BI /var/lib/dhcpc | ||
67 | Default | ||
68 | .I <ConfigDir> | ||
69 | directory used for storing files | ||
70 | @@ -332,7 +332,7 @@ | ||
71 | .I -d | ||
72 | debug flag. | ||
73 | .TP | ||
74 | -.BI <ConfigDir>/dhcpcd-<interface>.cache | ||
75 | +.BI /var/cache/dhcpcd-<interface>.cache | ||
76 | Cache file containing the previously assigned IP address and | ||
77 | some other things. | ||
78 | The word | ||
79 | @@ -379,7 +379,7 @@ | ||
80 | .B dhcpcd | ||
81 | exits for any reason. | ||
82 | .TP | ||
83 | -.BI <ConfigDir>/dhcpcd-<interface>.pid | ||
84 | +.BI /var/run/dhcpcd-<interface>.pid | ||
85 | file containing the process id of | ||
86 | .B dhcpcd. | ||
87 | The word | ||
88 | diff -Naur dhcpcd-1.3.22-pl4/dhcpcd.c dhcpcd-1.3.22-pl4-patched/dhcpcd.c | ||
89 | --- dhcpcd-1.3.22-pl4/dhcpcd.c 2003-01-01 02:26:32.000000000 +0100 | ||
90 | +++ dhcpcd-1.3.22-pl4-patched/dhcpcd.c 2003-01-19 15:46:13.000000000 +0100 | ||
91 | @@ -88,7 +88,7 @@ | ||
92 | { | ||
93 | int o; | ||
94 | char pidfile[64]; | ||
95 | - snprintf(pidfile,sizeof(pidfile),PID_FILE_PATH,ConfigDir,IfNameExt); | ||
96 | + snprintf(pidfile,sizeof(pidfile),PID_FILE_PATH,PID_DIR,IfNameExt); | ||
97 | o=open(pidfile,O_RDONLY); | ||
98 | if ( o == -1 ) return; | ||
99 | close(o); | ||
100 | diff -Naur dhcpcd-1.3.22-pl4/dhcpconfig.c dhcpcd-1.3.22-pl4-patched/dhcpconfig.c | ||
101 | --- dhcpcd-1.3.22-pl4/dhcpconfig.c 2002-12-29 23:05:44.000000000 +0100 | ||
102 | +++ dhcpcd-1.3.22-pl4-patched/dhcpconfig.c 2003-01-19 15:43:39.000000000 +0100 | ||
103 | @@ -556,7 +556,7 @@ | ||
104 | tsc: | ||
105 | memset(DhcpIface.version,0,sizeof(DhcpIface.version)); | ||
106 | strncpy(DhcpIface.version,VERSION,sizeof(DhcpIface.version)); | ||
107 | - snprintf(hostinfo_file_old,sizeof(hostinfo_file_old),DHCP_CACHE_FILE,ConfigDir,IfNameExt); | ||
108 | + snprintf(hostinfo_file_old,sizeof(hostinfo_file_old),DHCP_CACHE_FILE,CACHE_DIR,IfNameExt); | ||
109 | i=open(hostinfo_file_old,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR+S_IWUSR); | ||
110 | if ( i == -1 || | ||
111 | write(i,(char *)&DhcpIface,sizeof(dhcpInterface)) == -1 || | ||
112 | diff -Naur dhcpcd-1.3.22-pl4/pathnames.h dhcpcd-1.3.22-pl4-patched/pathnames.h | ||
113 | --- dhcpcd-1.3.22-pl4/pathnames.h 2002-09-29 17:55:31.000000000 +0200 | ||
114 | +++ dhcpcd-1.3.22-pl4-patched/pathnames.h 2003-01-19 15:25:03.000000000 +0100 | ||
115 | @@ -26,6 +26,8 @@ | ||
116 | #include <paths.h> | ||
117 | #include "dhcpcd.h" | ||
118 | |||
119 | +#define PID_DIR "/var/run" | ||
120 | +#define CACHE_DIR "/var/cache" | ||
121 | #define PID_FILE_PATH "%s/"PROGRAM_NAME"-%s.pid" | ||
122 | #define DHCP_CACHE_FILE "%s/"PROGRAM_NAME"-%s.cache" | ||
123 | #define DHCP_HOSTINFO "%s/"PROGRAM_NAME"-%s.info" | ||
124 | @@ -37,7 +39,7 @@ | ||
125 | #define NIS_CONF "/etc/config/yp.conf" | ||
126 | #define NTP_CONF "/etc/config/ntp.conf" | ||
127 | #else | ||
128 | -#define CONFIG_DIR "/etc/dhcpc" | ||
129 | +#define CONFIG_DIR "/var/lib/dhcpc" | ||
130 | #define RESOLV_CONF "/etc/resolv.conf" | ||
131 | #define NIS_CONF "/etc/yp.conf" | ||
132 | #define NTP_CONF "/etc/ntp.conf" | ||
133 | diff -Naur dhcpcd-1.3.22-pl4/signals.c dhcpcd-1.3.22-pl4-patched/signals.c | ||
134 | --- dhcpcd-1.3.22-pl4/signals.c 2002-01-20 23:51:46.000000000 +0100 | ||
135 | +++ dhcpcd-1.3.22-pl4-patched/signals.c 2003-01-19 15:49:33.000000000 +0100 | ||
136 | @@ -33,7 +33,6 @@ | ||
137 | |||
138 | extern char *ProgramName; | ||
139 | extern char *IfNameExt; | ||
140 | -extern char *ConfigDir; | ||
141 | extern int DebugFlag; | ||
142 | extern jmp_buf env; | ||
143 | extern void *(*currState)(); | ||
144 | @@ -44,7 +43,7 @@ | ||
145 | FILE *fp; | ||
146 | pid_t pid; | ||
147 | char pidfile[64]; | ||
148 | - snprintf(pidfile,sizeof(pidfile),PID_FILE_PATH,ConfigDir,IfNameExt); | ||
149 | + snprintf(pidfile,sizeof(pidfile),PID_FILE_PATH,PID_DIR,IfNameExt); | ||
150 | fp=fopen(pidfile,"r"); | ||
151 | if ( fp == NULL ) goto ntrn; | ||
152 | fscanf(fp,"%u",&pid); | ||
153 | @@ -63,7 +62,7 @@ | ||
154 | { | ||
155 | FILE *fp; | ||
156 | char pidfile[64]; | ||
157 | - snprintf(pidfile,sizeof(pidfile),PID_FILE_PATH,ConfigDir,IfNameExt); | ||
158 | + snprintf(pidfile,sizeof(pidfile),PID_FILE_PATH,PID_DIR,IfNameExt); | ||
159 | fp=fopen(pidfile,"w"); | ||
160 | if ( fp == NULL ) | ||
161 | { | ||
162 | @@ -77,7 +76,7 @@ | ||
163 | void deletePidFile() | ||
164 | { | ||
165 | char pidfile[64]; | ||
166 | - snprintf(pidfile,sizeof(pidfile),PID_FILE_PATH,ConfigDir,IfNameExt); | ||
167 | + snprintf(pidfile,sizeof(pidfile),PID_FILE_PATH,PID_DIR,IfNameExt); | ||
168 | unlink(pidfile); | ||
169 | } | ||
170 | /*****************************************************************************/ |