summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2012-01-17 09:50:55 -0800
committerJoern Engel <joern@logfs.org>2012-01-17 09:50:55 -0800
commitd3e3761bda56a89807f7fd1b24541aab9d332dbe (patch)
tree51612f3421f0bc9e16b939aec3536343e40c9549
parent672d19dc9e9eb74565f8616702c733a0872add45 (diff)
downloadcancd-d3e3761bda56a89807f7fd1b24541aab9d332dbe.tar.gz
Remove dirname() code
We no longer allow complicated name structures, so this code has become pointless. Signed-off-by: Joern Engel <joern@logfs.org>
-rw-r--r--cancd.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/cancd.c b/cancd.c
index b560ff0..467ecab 100644
--- a/cancd.c
+++ b/cancd.c
@@ -374,28 +374,14 @@ static struct source_ip *get_source_ip(struct sockaddr_in *addr)
static void do_output(char *buf, int len, struct sockaddr_in *addr, socklen_t socklen)
{
- int fd, rc;
+ int fd;
const char *name;
- char *tmp, *dir;
struct source_ip *sip = get_source_ip(addr);
name = sip->filename;
if (!name)
return;
- tmp = strdup(name);
- if (!tmp) {
- syslog(LOG_ERR, "Unable to allocate memory while logging to \"%s\"", name);
- return;
- }
-
- dir = dirname(tmp);
- rc = make_tree(dir, 0700);
- free(tmp);
-
- if (rc)
- return;
-
fd = open(name, O_WRONLY | O_APPEND | O_CREAT, 0600);
if (fd < 0)
syslog(LOG_ERR, "Unable to open \"%s\": %s", name, strerror(errno));