summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2002-07-17 17:00:26 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2002-07-17 17:00:26 +0000
commit893609d4ac6647bb983984653753292f8887f100 (patch)
tree52546f3be401d1a60ea7b96e2067ced04fd0b9e4 /usr.sbin
parentb2a764fd0bc8fdb44196c4bc95102c408ce87e96 (diff)
un-KNF to match apache source code style. requested by theo.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/httpd/src/main/fdcache.c79
1 files changed, 39 insertions, 40 deletions
diff --git a/usr.sbin/httpd/src/main/fdcache.c b/usr.sbin/httpd/src/main/fdcache.c
index f2d90d448c6..7a6616d7a5e 100644
--- a/usr.sbin/httpd/src/main/fdcache.c
+++ b/usr.sbin/httpd/src/main/fdcache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdcache.c,v 1.3 2002/07/17 13:51:42 henning Exp $ */
+/* $OpenBSD: fdcache.c,v 1.4 2002/07/17 17:00:25 henning Exp $ */
/*
* Copyright (c) 2002 Henning Brauer
@@ -36,9 +36,9 @@
#include <errno.h>
struct fdcache {
- char *fname;
- int fd;
- struct fdcache *next;
+ char *fname;
+ int fd;
+ struct fdcache *next;
};
struct fdcache *fdc;
@@ -46,49 +46,48 @@ struct fdcache *fdc;
int
fdcache_open(char *fn, int flags, mode_t mode)
{
- struct fdcache *fdcp = NULL, *tmp = NULL;
+ struct fdcache *fdcp = NULL, *tmp = NULL;
- for (fdcp = fdc; fdcp && strncmp(fn, fdcp->fname, 1024);
- fdcp = fdcp->next);
- /* nothing */
+ for (fdcp = fdc; fdcp && strncmp(fn, fdcp->fname, 1024); fdcp = fdcp->next);
+ /* nothing */
- if (fdcp == NULL) {
- /* need to open */
- tmp = calloc(1, sizeof(struct fdcache));
- if (tmp == NULL) {
- fprintf(stderr, "calloc failed\n");
- exit(1);
- }
- tmp->fname = malloc(strlen(fn) + 1);
- if (tmp->fname == NULL) {
- fprintf(stderr, "malloc failed\n");
- exit(1);
- }
- strlcpy(tmp->fname, fn, strlen(fn) + 1);
- if ((tmp->fd = open(fn, flags, mode)) < 0) {
- fprintf(stderr, "Cannot open %s: %s\n",
- tmp->fname, strerror(errno));
- exit(1);
- }
- tmp->next = fdc;
- fdc = tmp;
- return(fdc->fd);
- } else
- return(fdcp->fd); /* fd cached */
+ if (fdcp == NULL) {
+ /* need to open */
+ tmp = calloc(1, sizeof(struct fdcache));
+ if (tmp == NULL) {
+ fprintf(stderr, "calloc failed\n");
+ exit(1);
+ }
+ tmp->fname = malloc(strlen(fn) + 1);
+ if (tmp->fname == NULL) {
+ fprintf(stderr, "malloc failed\n");
+ exit(1);
+ }
+ strlcpy(tmp->fname, fn, strlen(fn) + 1);
+ if ((tmp->fd = open(fn, flags, mode)) < 0) {
+ fprintf(stderr, "Cannot open %s: %s\n",
+ tmp->fname, strerror(errno));
+ exit(1);
+ }
+ tmp->next = fdc;
+ fdc = tmp;
+ return(fdc->fd);
+ } else
+ return(fdcp->fd); /* fd cached */
}
void
fdcache_closeall()
{
- struct fdcache *fdcp = NULL, *tmp = NULL;
+ struct fdcache *fdcp = NULL, *tmp = NULL;
- for (fdcp = fdc; fdcp; ) {
- tmp = fdcp;
- fdcp = tmp->next;
- if (tmp->fd > 0)
- close(tmp->fd);
- free(tmp->fname);
- free(tmp);
- }
+ for (fdcp = fdc; fdcp; ) {
+ tmp = fdcp;
+ fdcp = tmp->next;
+ if (tmp->fd > 0)
+ close(tmp->fd);
+ free(tmp->fname);
+ free(tmp);
+ }
}