]> git.ipfire.org Git - people/ms/dma.git/blobdiff - spool.c
Merge pull request #34 from mtremer/better-authentication
[people/ms/dma.git] / spool.c
diff --git a/spool.c b/spool.c
index fa4265401fb6e0fa760848e658071a68697806aa..e9c9c4355ab45e62c26b0582aa81228c9653fa32 100644 (file)
--- a/spool.c
+++ b/spool.c
@@ -1,8 +1,9 @@
 /*
+ * Copyright (c) 2008-2014, Simon Schubert <2@0x2c.org>.
  * Copyright (c) 2008 The DragonFly Project.  All rights reserved.
  *
  * This code is derived from software contributed to The DragonFly Project
- * by Simon 'corecode' Schubert <corecode@fs.ei.tum.de>.
+ * by Simon Schubert <2@0x2c.org>.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -289,7 +290,7 @@ load_queue(struct queue *queue)
 
        spooldir = opendir(config.spooldir);
        if (spooldir == NULL)
-               err(1, "reading queue");
+               err(EX_NOINPUT, "reading queue");
 
        while ((de = readdir(spooldir)) != NULL) {
                queuefn = NULL;
@@ -429,18 +430,12 @@ flushqueue_signal(void)
 
         if (asprintf(&flushfn, "%s/%s", config.spooldir, SPOOL_FLUSHFILE) < 0)
                return (-1);
-       fd = open(flushfn, O_CREAT|O_RDONLY, 0440);
+       fd = open(flushfn, O_CREAT|O_WRONLY|O_TRUNC, 0660);
+       free(flushfn);
        if (fd < 0) {
                syslog(LOG_ERR, "could not open flush file: %m");
-               free(flushfn);
                return (-1);
        }
         close(fd);
-        if (utimes(flushfn, NULL) < 0) {
-               syslog(LOG_ERR, "could not touch flush file: %m");
-               free(flushfn);
-               return (-1);
-       }
-       free (flushfn);
        return (0);
 }