Index: files.c --- files.c.orig +++ files.c @@ -334,11 +334,7 @@ mkfilename(struct place *place, const char *dir, const rlen = dlen + (needslash ? 1 : 0) + flen; ret = domalloc(rlen + 1); - strcpy(ret, dir); - if (needslash) { - strcat(ret, "/"); - } - strcat(ret, file); + snprintf(ret, rlen+1, "%s%s%s", dir, needslash ? "/" : "", file); return ret; } @@ -351,7 +347,7 @@ file_tryopen(const char *file) /* XXX check for non-regular files */ fd = open(file, O_RDONLY); - if (fd < 0) { + if (fd == -1) { if (errno != ENOENT && errno != ENOTDIR) { complain(NULL, "%s: %s", file, strerror(errno)); }