Commit 7350e633 by Shawn O. Pearce

Define gitfo_exists to determine file presence

When scanning the pack directory we need to see if the path
name is present for ".idx" when we discover a ".pack" file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
parent 2c4b7707
...@@ -53,6 +53,12 @@ int gitfo_write(git_file fd, void *buf, size_t cnt) ...@@ -53,6 +53,12 @@ int gitfo_write(git_file fd, void *buf, size_t cnt)
return GIT_SUCCESS; return GIT_SUCCESS;
} }
int gitfo_exists(const char *path)
{
struct stat sb;
return stat(path, &sb);
}
off_t gitfo_size(git_file fd) off_t gitfo_size(git_file fd)
{ {
struct stat sb; struct stat sb;
......
...@@ -31,6 +31,7 @@ typedef struct { /* file io buffer */ ...@@ -31,6 +31,7 @@ typedef struct { /* file io buffer */
} gitfo_buf; } gitfo_buf;
extern int gitfo_exists(const char *path);
extern int gitfo_open(const char *path, int flags); extern int gitfo_open(const char *path, int flags);
extern int gitfo_creat(const char *path, int mode); extern int gitfo_creat(const char *path, int mode);
#define gitfo_close(fd) close(fd) #define gitfo_close(fd) close(fd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment