bytes++;
}
+ /* If size == 0 there is no space for a final null... */
if (size)
*q = '\0';
+
return bytes;
}
bytes++;
}
- if (size)
- *q = '\0';
+ *q = '\0';
return bytes;
}
#endif /* __OWN_STRLCPYCAT__ */
char *tail;
if (file_map(dbfile, &buf, &bufsize) != 0) {
- dbg("can't open '%s' as db file", dbfile);
+ dbg("can't open '%s' as db file: %s", dbfile, strerror(errno));
return 0;
}
dbg("search '%s' in '%s'", uname, dbfile);
if (count >= sizeof(line))
continue;
- strlcpy(line, bufline, count);
+ memcpy(line, bufline, count-1);
+ line[count-1] = '\0';
pos = line;
/* get name */