| @@ -1091,7 +1091,7 @@ main(int argc, char *argv[])
size_t n;
int i, fd;
- if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
err(1, "pledge");
setlocale(LC_CTYPE, "");
@@ -1111,6 +1111,8 @@ main(int argc, char *argv[])
cachefile = argv[++i];
}
}
+ if (!cachefile && pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
if (!repodir)
usage(argv[0]);
@@ -1131,10 +1133,6 @@ main(int argc, char *argv[])
head = git_object_id(obj);
git_object_free(obj);
- /* don't cache if there is no HEAD */
- if (!head)
- cachefile = NULL;
-
/* use directory name as name */
if ((name = strrchr(repodirabs, '/')))
name++;
@@ -1196,7 +1194,7 @@ main(int argc, char *argv[])
fprintf(fp, "%-50.50s ", "Commit message");
fprintf(fp, "%s\n", "Author");
- if (cachefile) {
+ if (cachefile && head) {
/* read from cache file (does not need to exist) */
if ((rcachefp = fopen(cachefile, "r"))) {
if (!fgets(lastoidstr, sizeof(lastoidstr), rcachefp))
@@ -1258,7 +1256,7 @@ main(int argc, char *argv[])
fclose(fp);
/* rename new cache file on success */
- if (cachefile) {
+ if (cachefile && head) {
if (rename(tmppath, cachefile))
err(1, "rename: '%s' to '%s'", tmppath, cachefile);
umask((mask = umask(0))); |