commit - b46517d07b921397f37d269bb82fb62912df177d
commit + 66c889b39514153efd49214703ef06a538eb2ee4
blob - 5d1c2e817373f8450d2af8dc48ea04aeada52476
blob + 053e136878b01169876161b848bd4dc87fd8ac43
--- lib/reference.c
+++ lib/reference.c
}
if (fstat(fileno(f), &sb) == -1) {
err = got_error_from_errno2("fstat", abspath);
+ goto done;
+ }
+ if (!S_ISREG(sb.st_mode)) {
+ err = got_error(GOT_ERR_NOT_REF);
+ if (lock)
+ got_lockfile_unlock(lf, -1);
goto done;
}
if (feof(f))
err = NULL; /* ignore empty files (could be locks) */
else {
- if (errno == EISDIR)
- err = got_error(GOT_ERR_NOT_REF);
- else if (ferror(f))
+ if (ferror(f))
err = got_ferror(f, GOT_ERR_IO);
else
err = got_error_from_errno2("getline", abspath);