#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include <string.h>
#include <stringbucket.h>
flock(obj->fd, LOCK_UN);
obj->size = st.st_size;
obj->list = mmap(NULL, obj->size, PROT_READ | PROT_WRITE, MAP_SHARED, obj->fd, 0);
- if (obj->list == NULL) {
+ if (obj->list == MAP_FAILED) {
perror("stringbucket mmap");
close(obj->fd);
free(obj);
/* We doin' it DOS style! */
sb->list[pos] = 0;
+ return 1;
}
void stringbucket_iterate(struct stringbucket *sb, void (*iter)(char *, void *), void *stuff) {