Make read_in_full() and write_in_full() consistent with xread() and xwrite()
xread() and xwrite() return ssize_t values as their native POSIX counterparts read(2) and write(2). To be consistent, read_in_full() and write_in_full() should also return ssize_t values. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
9f1915d393
commit
0104ca09e3
4
cache.h
4
cache.h
@ -726,8 +726,8 @@ extern const char *git_log_output_encoding;
|
|||||||
extern void maybe_flush_or_die(FILE *, const char *);
|
extern void maybe_flush_or_die(FILE *, const char *);
|
||||||
extern int copy_fd(int ifd, int ofd);
|
extern int copy_fd(int ifd, int ofd);
|
||||||
extern int copy_file(const char *dst, const char *src, int mode);
|
extern int copy_file(const char *dst, const char *src, int mode);
|
||||||
extern int read_in_full(int fd, void *buf, size_t count);
|
extern ssize_t read_in_full(int fd, void *buf, size_t count);
|
||||||
extern int write_in_full(int fd, const void *buf, size_t count);
|
extern ssize_t write_in_full(int fd, const void *buf, size_t count);
|
||||||
extern void write_or_die(int fd, const void *buf, size_t count);
|
extern void write_or_die(int fd, const void *buf, size_t count);
|
||||||
extern int write_or_whine(int fd, const void *buf, size_t count, const char *msg);
|
extern int write_or_whine(int fd, const void *buf, size_t count, const char *msg);
|
||||||
extern int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg);
|
extern int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg);
|
||||||
|
3
path.c
3
path.c
@ -91,7 +91,8 @@ int validate_headref(const char *path)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
char *buf, buffer[256];
|
char *buf, buffer[256];
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
int len, fd;
|
int fd;
|
||||||
|
ssize_t len;
|
||||||
|
|
||||||
if (lstat(path, &st) < 0)
|
if (lstat(path, &st) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
3
refs.c
3
refs.c
@ -368,7 +368,8 @@ int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *re
|
|||||||
|
|
||||||
const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *flag)
|
const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *flag)
|
||||||
{
|
{
|
||||||
int depth = MAXDEPTH, len;
|
int depth = MAXDEPTH;
|
||||||
|
ssize_t len;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
static char ref_buffer[256];
|
static char ref_buffer[256];
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ void maybe_flush_or_die(FILE *f, const char *desc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_in_full(int fd, void *buf, size_t count)
|
ssize_t read_in_full(int fd, void *buf, size_t count)
|
||||||
{
|
{
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
ssize_t total = 0;
|
ssize_t total = 0;
|
||||||
@ -57,7 +57,7 @@ int read_in_full(int fd, void *buf, size_t count)
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_in_full(int fd, const void *buf, size_t count)
|
ssize_t write_in_full(int fd, const void *buf, size_t count)
|
||||||
{
|
{
|
||||||
const char *p = buf;
|
const char *p = buf;
|
||||||
ssize_t total = 0;
|
ssize_t total = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user