Various cleanup
[blerg.git] / database / subscription.c
index b2c89d4..c1633fe 100644 (file)
@@ -5,11 +5,13 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
 #include "subscription.h"
 #include "stringbucket.h"
+#include "util.h"
 #include "config.h"
 #include "configuration.h"
 
@@ -86,12 +88,12 @@ struct blergref * subscription_list(const char *author, uint64_t offset, int *co
        int feed_fd = open(filename, O_RDONLY);
        if (feed_fd == -1) {
                perror("Could not open subscription feed");
-               goto subscription_list_map_failed;
+               goto subscription_list_open_failed;
        }
 
        fstat(feed_fd, &st);
        if (st.st_size == 0) {
-               close(feed_fd);
+               fprintf(stderr, "Feed is empty\n");
                goto subscription_list_map_failed;
        }
        n_subscription_records = st.st_size / sizeof(struct blergref);