/*
* Search for a line beginning with "From ", and
- * having smething that looks like a date format.
+ * having something that looks like a date format.
*/
do {
int len = linelen(map, size);
}
size = st.st_size;
map = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (-1 == (int)(long)map) {
+ if (map == MAP_FAILED) {
perror("mmap");
+ close(fd);
exit(1);
}
close(fd);
unsigned long len = parse_email(map, size);
assert(len <= size);
sprintf(name, "%04d", ++nr);
- fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd < 0) {
perror(name);
exit(1);