Skip to content

Commit ae193ea

Browse files
committed
* pathexec_env.c, socklog-conf.c, socklog.c, tryto.c, uncat.c: whitespace
1 parent e1776bc commit ae193ea

File tree

9 files changed

+95
-94
lines changed

9 files changed

+95
-94
lines changed

package/CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* pathexec_env.c, socklog-conf.c, socklog.c, tryto.c, uncat.c: whitespace.
12
* socklog.c: fix compilation warning -Wpointer-sign.
23
* socklog.c, man/socklog.8: add -T to drop timestamps from syslog messages
34
(github/leahneukirchen).

src/pathexec_env.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ void pathexec(char *const *argv)
5252
if (!plus.s[i]) {
5353
split = str_chr(plus.s + j,'=');
5454
for (t = 0;t < elen;++t)
55-
if (byte_equal(plus.s + j,split,e[t]))
56-
if (e[t][split] == '=') {
57-
--elen;
58-
e[t] = e[elen];
59-
break;
60-
}
55+
if (byte_equal(plus.s + j,split,e[t]))
56+
if (e[t][split] == '=') {
57+
--elen;
58+
e[t] = e[elen];
59+
break;
60+
}
6161
if (plus.s[j + split])
62-
e[elen++] = plus.s + j;
62+
e[elen++] = plus.s + j;
6363
j = i + 1;
6464
}
6565
e[elen] = 0;

src/socklog-conf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void conf_unix() {
168168
outs("exec socklog-check unix /dev/log\n");
169169
finish();
170170
perm(0755);
171-
171+
172172
start("socklog-unix/log/run");
173173
outs("#!/bin/sh\n");
174174
outs("exec chpst -u");

src/socklog-conf.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ usage: socklog-conf unix|inet|klog|ucspi acct logacct [/etc/sv] [/logdir]
22
usage: socklog-conf notify acct grp [/etc/sv] [pipe]
33

44
1
5-
$Id: fcce5763474a7e285e1ea9606467950828a888e2 $
5+
$Id: a3bb6095611c862dd72551714fda7f2b7787d9ad $
66

77
usage: socklog-conf unix|inet|klog|ucspi acct logacct [/etc/sv] [/logdir]
88
usage: socklog-conf notify acct grp [/etc/sv] [pipe]

src/socklog.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ int read_socket (int s) {
244244
linec =recvfrom(s, line, LINEC, 0, (struct sockaddr *) &saf, &dummy);
245245
if (linec == -1) {
246246
if (errno != error_intr)
247-
strerr_die2sys(111, FATAL, "recvfrom(): ");
247+
strerr_die2sys(111, FATAL, "recvfrom(): ");
248248
else
249-
linec =0;
249+
linec =0;
250250
}
251251
if (flag_exitasap) break;
252252

@@ -256,12 +256,12 @@ int read_socket (int s) {
256256
if (lograw) {
257257
buffer_put(buffer_1, line, linec);
258258
if (line[linec -1] != '\n') {
259-
if (linec == LINEC) out("...", 0);
260-
out("\n", 0);
259+
if (linec == LINEC) out("...", 0);
260+
out("\n", 0);
261261
}
262262
if (lograw == 2) {
263-
buffer_flush(buffer_1);
264-
continue;
263+
buffer_flush(buffer_1);
264+
continue;
265265
}
266266
}
267267

@@ -306,20 +306,20 @@ int read_ucspi (int fd, char **vars) {
306306

307307
for (l =p =line; l -line < linec; l++) {
308308
if (flageol) {
309-
if (! *l || (*l == '\n')) continue;
310-
for (i =0; envs[i]; i++) {
311-
err(envs[i], ": ", 0);
312-
}
313-
/* could fail on eg <13\0>user.notice: ... */
314-
l += scan_syslog_names(l, line -l +linec, buffer_2);
315-
if (skiptime) l += skip_timestamp(l, line -l +linec);
316-
p =l;
317-
flageol =0;
309+
if (! *l || (*l == '\n')) continue;
310+
for (i =0; envs[i]; i++) {
311+
err(envs[i], ": ", 0);
312+
}
313+
/* could fail on eg <13\0>user.notice: ... */
314+
l += scan_syslog_names(l, line -l +linec, buffer_2);
315+
if (skiptime) l += skip_timestamp(l, line -l +linec);
316+
p =l;
317+
flageol =0;
318318
}
319319
if (! *l || (*l == '\n')) {
320-
buffer_put(buffer_2, p, l -p);
321-
buffer_putsflush(buffer_2, "\n");
322-
flageol =1;
320+
buffer_put(buffer_2, p, l -p);
321+
buffer_putsflush(buffer_2, "\n");
322+
flageol =1;
323323
}
324324
}
325325
if (!flageol) buffer_putflush(buffer_2, p, l -p);
@@ -329,7 +329,7 @@ int read_ucspi (int fd, char **vars) {
329329
#ifdef SOLARIS
330330
#if WANT_SUN_DOOR
331331
static void door_proc(void *cookie, char *argp, size_t arg_size,
332-
door_desc_t *dp, uint_t ndesc) {
332+
door_desc_t *dp, uint_t ndesc) {
333333
door_return(NULL, 0, NULL, 0);
334334
return;
335335
}
@@ -453,14 +453,14 @@ int main(int argc, char **argv) {
453453
if (! *(++*argv)) usage();
454454
switch (**argv) {
455455
case 'n':
456-
mode =MODE_UNIX;
457-
break;
456+
mode =MODE_UNIX;
457+
break;
458458
case 'c':
459-
mode =MODE_UCSPI;
460-
argv--;
461-
break;
459+
mode =MODE_UCSPI;
460+
argv--;
461+
break;
462462
default:
463-
usage();
463+
usage();
464464
}
465465
break;
466466
case 'i':

src/tryto.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ int main (int argc, char * const *argv, char * const *envp) {
113113

114114
if (processor) {
115115
buffer_init(&buffer_x, buffer_unixread, 4, buffer_x_space,
116-
sizeof buffer_x_space);
116+
sizeof buffer_x_space);
117117
} else {
118118
buffer_init(&buffer_x, buffer_unixread, 0, buffer_x_space,
119-
sizeof buffer_x_space);
119+
sizeof buffer_x_space);
120120
}
121121

122122
/* start real processor */
@@ -125,7 +125,7 @@ int main (int argc, char * const *argv, char * const *envp) {
125125
}
126126
while ((pid =fork()) == -1) {
127127
strerr_warn4(WARNING, "unable to fork for \"", *argv, "\" pausing: ",
128-
&strerr_sys);
128+
&strerr_sys);
129129
sleep(5);
130130
}
131131
if (!pid) {
@@ -138,8 +138,8 @@ int main (int argc, char * const *argv, char * const *envp) {
138138
close(cpipe[1]);
139139
fd_move(0, cpipe[0]);
140140
if (processor) {
141-
fd_move(2, 5);
142-
close(4);
141+
fd_move(2, 5);
142+
close(4);
143143
}
144144
if (pgroup) setsid();
145145
pathexec_run(*argv, argv, envp);
@@ -177,26 +177,26 @@ int main (int argc, char * const *argv, char * const *envp) {
177177

178178
r = buffer_feed(&buffer_x);
179179
if (r < 0) {
180-
if ((errno == error_intr) || (errno == error_again)) continue;
180+
if ((errno == error_intr) || (errno == error_again)) continue;
181181
}
182182
if (r == 0) {
183-
if (processor && (buffer_x.fd == 4)) {
184-
x[1].fd =0;
185-
buffer_init(&buffer_x, buffer_unixread, 0, buffer_x_space,
186-
sizeof buffer_x_space);
187-
continue;
188-
}
189-
if (iopausefds == 2) {
190-
close(cpipe[1]);
191-
iopausefds =1;
192-
}
193-
continue;
183+
if (processor && (buffer_x.fd == 4)) {
184+
x[1].fd =0;
185+
buffer_init(&buffer_x, buffer_unixread, 0, buffer_x_space,
186+
sizeof buffer_x_space);
187+
continue;
188+
}
189+
if (iopausefds == 2) {
190+
close(cpipe[1]);
191+
iopausefds =1;
192+
}
193+
continue;
194194
}
195195
s =buffer_peek(&buffer_x);
196196
i =write(cpipe[1], s, r);
197197
if (i == -1) strerr_die2sys(111, FATAL, "unable to write to child: ");
198198
if (i < r)
199-
strerr_die2x(111, FATAL, "unable to write to child: partial write");
199+
strerr_die2x(111, FATAL, "unable to write to child: partial write");
200200

201201
buffer_seek(&buffer_x, r);
202202
}
@@ -206,7 +206,7 @@ int main (int argc, char * const *argv, char * const *envp) {
206206
if (wait_nohang(&rc) == pid) break;
207207
/* child not finished */
208208
strerr_warn4(WARNING,
209-
"child \"", *argv, "\" timed out. sending TERM...", 0);
209+
"child \"", *argv, "\" timed out. sending TERM...", 0);
210210
kill(pgroup ? -pid : pid, SIGTERM);
211211

212212
/* ktimeout sec timeout */
@@ -223,8 +223,8 @@ int main (int argc, char * const *argv, char * const *envp) {
223223
while (read(selfpipe[0], &ch, 1) == 1) {}
224224

225225
if (wait_nohang(&rc) == pid) {
226-
strerr_warn2(WARNING, "child terminated.", 0);
227-
break;
226+
strerr_warn2(WARNING, "child terminated.", 0);
227+
break;
228228
}
229229
rc =111;
230230
taia_now(&now);
@@ -240,8 +240,8 @@ int main (int argc, char * const *argv, char * const *envp) {
240240
if (rc == 0) _exit(0);
241241
if (verbose) strerr_warn2(WARNING, "child crashed.", 0);
242242
if (lseek(0, 0, SEEK_SET) != 0)
243-
if (verbose) strerr_warn2(WARNING,
244-
"unable to lseek fd 0: ", &strerr_sys);
243+
if (verbose) strerr_warn2(WARNING,
244+
"unable to lseek fd 0: ", &strerr_sys);
245245
if (try >= trymax) break;
246246
sleep(1);
247247
}
@@ -253,10 +253,10 @@ int main (int argc, char * const *argv, char * const *envp) {
253253

254254
r = buffer_feed(buffer_0);
255255
if (r < 0) {
256-
if ((errno == error_intr) || (errno == error_again)) continue;
256+
if ((errno == error_intr) || (errno == error_again)) continue;
257257
}
258258
if (r == 0) {
259-
break;
259+
break;
260260
}
261261
s =buffer_peek(buffer_0);
262262
buffer_putflush(buffer_1, s, r);

src/tryto.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
usage: tryto [-vp] [-t seconds] [-k kseconds] [-n tries] prog
22

33
1
4-
$Id: 45d3311a8f957c1174d9edbbb13fd4c068a760a8 $
4+
$Id: b84001113c2fc2d4f710c9859831c09bf0365109 $
55

66
usage: tryto [-vp] [-t seconds] [-k kseconds] [-n tries] prog
77

src/uncat.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ int main (int argc, char * const *argv, char * const *envp) {
9696

9797
taia_now(&now);
9898
if (taia_less(&deadline, &now)) {
99-
if (verbose && sa.len) strerr_warn2(WARNING, "timeout reached.", 0);
100-
break;
99+
if (verbose && sa.len) strerr_warn2(WARNING, "timeout reached.", 0);
100+
break;
101101
}
102102
iofd.fd =0;
103103
iofd.events =IOPAUSE_READ;
@@ -107,70 +107,70 @@ int main (int argc, char * const *argv, char * const *envp) {
107107
sig_block(sig_term);
108108

109109
if (exitasap) {
110-
if (verbose) strerr_warn2(WARNING, "got sigterm.", 0);
111-
break;
110+
if (verbose) strerr_warn2(WARNING, "got sigterm.", 0);
111+
break;
112112
}
113113

114114
r =buffer_feed(buffer_0);
115115
if (r < 0) {
116-
if (errno == error_again) continue;
117-
strerr_die2sys(111, FATAL, "unable to read fd 0: ");
116+
if (errno == error_again) continue;
117+
strerr_die2sys(111, FATAL, "unable to read fd 0: ");
118118
}
119119
if (r == 0) {
120-
if (verbose) strerr_warn2(WARNING, "end of input.", 0);
121-
if (! once) continue;
122-
eof++;
123-
break;
120+
if (verbose) strerr_warn2(WARNING, "end of input.", 0);
121+
if (! once) continue;
122+
eof++;
123+
break;
124124
}
125125
if (r >= sizemax) r =sizemax;
126126
if ((sa.len +r) > sizemax) {
127-
if (verbose) strerr_warn2(WARNING, "max size reached.", 0);
128-
break;
127+
if (verbose) strerr_warn2(WARNING, "max size reached.", 0);
128+
break;
129129
}
130130
s =buffer_peek(buffer_0);
131131
if (! stralloc_catb(&sa, s, r)) {
132-
strerr_die2sys(111, FATAL, "out of memory: ");
132+
strerr_die2sys(111, FATAL, "out of memory: ");
133133
}
134134
buffer_seek(buffer_0, r);
135135
}
136136
if (sa.len) {
137137
/* run prog to process sa.s */
138138
if (pipe(cpipe) == -1) {
139-
strerr_die2sys(111, FATAL, "unable to create pipe for child: ");
139+
strerr_die2sys(111, FATAL, "unable to create pipe for child: ");
140140
}
141141
while ((pid =fork()) == -1) {
142-
strerr_warn4(WARNING, "unable to fork for \"", *argv, "\" pausing: ",
143-
&strerr_sys);
144-
sleep(5);
142+
strerr_warn4(WARNING, "unable to fork for \"", *argv, "\" pausing: ",
143+
&strerr_sys);
144+
sleep(5);
145145
}
146146
if (!pid) {
147-
/* child */
148-
149-
sig_uncatch(sig_term);
150-
sig_unblock(sig_term);
151-
152-
close(cpipe[1]);
153-
fd_move(0, cpipe[0]);
154-
fd_copy(1, 2);
155-
156-
if (verbose) strerr_warn2(WARNING, "starting child.", 0);
157-
pathexec_run(*argv, argv, envp);
158-
strerr_die2sys(111, FATAL, "unable to start child: ");
147+
/* child */
148+
149+
sig_uncatch(sig_term);
150+
sig_unblock(sig_term);
151+
152+
close(cpipe[1]);
153+
fd_move(0, cpipe[0]);
154+
fd_copy(1, 2);
155+
156+
if (verbose) strerr_warn2(WARNING, "starting child.", 0);
157+
pathexec_run(*argv, argv, envp);
158+
strerr_die2sys(111, FATAL, "unable to start child: ");
159159
}
160160

161161
close(cpipe[0]);
162162
if (write(cpipe[1], sa.s, sa.len) < sa.len) {
163-
strerr_warn2(WARNING, "unable to write to child: ", &strerr_sys);
163+
strerr_warn2(WARNING, "unable to write to child: ", &strerr_sys);
164164
}
165165
close(cpipe[1]);
166166

167167
if (wait_pid(&wstat, pid) != pid) {
168-
strerr_die2sys(111, FATAL, "wait_pid: ");
168+
strerr_die2sys(111, FATAL, "wait_pid: ");
169169
}
170170
if (wait_crashed(wstat)) {
171-
strerr_warn2(WARNING, "child crashed.", 0);
171+
strerr_warn2(WARNING, "child crashed.", 0);
172172
} else {
173-
if (verbose) strerr_warn2(WARNING, "child exited.", 0);
173+
if (verbose) strerr_warn2(WARNING, "child exited.", 0);
174174
}
175175
}
176176

src/uncat.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
usage: uncat [-vo] [-t timeout] [-s size] prog
22

33
1
4-
$Id: 5885dd2051467fd6c89a8cba13b05692f1c888af $
4+
$Id: 3f1e4209ad183dfa61599248a24ecba4e253ead3 $
55

66
usage: uncat [-vo] [-t timeout] [-s size] prog
77

0 commit comments

Comments
 (0)