Skip to content

Commit 54e52b0

Browse files
committed
Just style nits before someone goes and does something significant. Submitted by: Victor J. Orlikowski [v.j.orlikowski@gte.net] Reviewed by: William Rowe git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86996 13f79535-47bb-0310-9956-ffa450edef68
1 parent 94593f9 commit 54e52b0

1 file changed

Lines changed: 44 additions & 44 deletions

File tree

support/rotatelogs.c

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
#include <errno.h>
7272
#include <fcntl.h>
7373

74-
#define BUFSIZE 65536
74+
#define BUFSIZE 65536
7575

7676
#ifndef MAX_PATH
77-
#define MAX_PATH 1024
77+
#define MAX_PATH 1024
7878
#endif
7979

8080
int main (int argc, char *argv[])
@@ -87,59 +87,59 @@ int main (int argc, char *argv[])
8787
char *szLogRoot;
8888

8989
if (argc != 3) {
90-
fprintf(stderr,
91-
"%s <logfile> <rotation time in seconds>\n\n",
92-
argv[0]);
90+
fprintf(stderr,
91+
"%s <logfile> <rotation time in seconds>\n\n",
92+
argv[0]);
9393
#ifdef OS2
94-
fprintf(stderr,
95-
"Add this:\n\nTransferLog \"|%s.exe /some/where 86400\"\n\n",
96-
argv[0]);
94+
fprintf(stderr,
95+
"Add this:\n\nTransferLog \"|%s.exe /some/where 86400\"\n\n",
96+
argv[0]);
9797
#else
98-
fprintf(stderr,
99-
"Add this:\n\nTransferLog \"|%s /some/where 86400\"\n\n",
100-
argv[0]);
98+
fprintf(stderr,
99+
"Add this:\n\nTransferLog \"|%s /some/where 86400\"\n\n",
100+
argv[0]);
101101
#endif
102-
fprintf(stderr,
103-
"to httpd.conf. The generated name will be /some/where.nnnn "
104-
"where nnnn is the\nsystem time at which the log nominally "
105-
"starts (N.B. this time will always be a\nmultiple of the "
106-
"rotation time, so you can synchronize cron scripts with it).\n"
107-
"At the end of each rotation time a new log is started.\n");
108-
exit(1);
102+
fprintf(stderr,
103+
"to httpd.conf. The generated name will be /some/where.nnnn "
104+
"where nnnn is the\nsystem time at which the log nominally "
105+
"starts (N.B. this time will always be a\nmultiple of the "
106+
"rotation time, so you can synchronize cron scripts with it).\n"
107+
"At the end of each rotation time a new log is started.\n");
108+
exit(1);
109109
}
110110

111111
szLogRoot = argv[1];
112112
tRotation = atoi(argv[2]);
113113
if (tRotation <= 0) {
114-
fprintf(stderr, "Rotation time must be > 0\n");
115-
exit(6);
114+
fprintf(stderr, "Rotation time must be > 0\n");
115+
exit(6);
116116
}
117117

118118
for (;;) {
119-
nRead = read(0, buf, sizeof buf);
120-
if (nRead == 0)
121-
exit(3);
122-
if (nRead < 0)
123-
if (errno != EINTR)
124-
exit(4);
125-
if (nLogFD >= 0 && (time(NULL) >= tLogEnd || nRead < 0)) {
126-
close(nLogFD);
127-
nLogFD = -1;
128-
}
129-
if (nLogFD < 0) {
130-
time_t tLogStart = (time(NULL) / tRotation) * tRotation;
131-
sprintf(buf2, "%s.%010d", szLogRoot, (int) tLogStart);
132-
tLogEnd = tLogStart + tRotation;
133-
nLogFD = open(buf2, O_WRONLY | O_CREAT | O_APPEND, 0666);
134-
if (nLogFD < 0) {
135-
perror(buf2);
136-
exit(2);
137-
}
138-
}
139-
if (write(nLogFD, buf, nRead) != nRead) {
140-
perror(buf2);
141-
exit(5);
142-
}
119+
nRead = read(0, buf, sizeof buf);
120+
if (nRead == 0)
121+
exit(3);
122+
if (nRead < 0)
123+
if (errno != EINTR)
124+
exit(4);
125+
if (nLogFD >= 0 && (time(NULL) >= tLogEnd || nRead < 0)) {
126+
close(nLogFD);
127+
nLogFD = -1;
128+
}
129+
if (nLogFD < 0) {
130+
time_t tLogStart = (time(NULL) / tRotation) * tRotation;
131+
sprintf(buf2, "%s.%010d", szLogRoot, (int) tLogStart);
132+
tLogEnd = tLogStart + tRotation;
133+
nLogFD = open(buf2, O_WRONLY | O_CREAT | O_APPEND, 0666);
134+
if (nLogFD < 0) {
135+
perror(buf2);
136+
exit(2);
137+
}
138+
}
139+
if (write(nLogFD, buf, nRead) != nRead) {
140+
perror(buf2);
141+
exit(5);
142+
}
143143
}
144144
/* Of course we never, but prevent compiler warnings */
145145
return 0;

0 commit comments

Comments
 (0)