#include "str.h"
#include "file.h"
-#include "../lib/debug.h"
-
#ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
#endif
if (lstat (path, &osb) < 0 || fstat(fd, &nsb) < 0
|| compare_stat(&osb, &nsb) == -1)
{
- debug_print(1, ("%s is a symlink!\n", path));
close(fd);
return -1;
}
char buf[BUFSIZ];
unlink(s);
- p_clear(buf, sizeof(buf));
+ p_clear(buf, countof(buf));
while (sb.st_size > 0) {
fwrite(buf, 1, MIN(ssizeof(buf), sb.st_size), f);
sb.st_size -= MIN(ssizeof(buf), sb.st_size);
* If a line ends with "\", this char and the linefeed is removed,
* and the next line is read too.
*/
-char *mutt_read_line(char *s, size_t *size, FILE * fp, int *line)
+char *mutt_read_line(char *s, ssize_t *size, FILE * fp, int *line)
{
- size_t offset = 0;
+ ssize_t offset = 0;
char *ch;
if (!s) {
char buf[BUFSIZ];
size_t l;
- while ((l = fread(buf, 1, sizeof (buf), fin)) > 0) {
+ while ((l = fread(buf, 1, sizeof(buf), fin)) > 0) {
if (fwrite(buf, 1, l, fout) != l)
return -1;
}
return 0;
}
-int mutt_copy_bytes(FILE *in, FILE *out, size_t size)
+int mutt_copy_bytes(FILE *in, FILE *out, ssize_t size)
{
char buf[BUFSIZ];
while (size > 0) {
- size_t chunk = MIN(size, sizeof(buf));
+ size_t chunk = MIN(size, ssizeof(buf));
if ((chunk = fread(buf, 1, chunk, in)) < 1)
break;
if (fwrite(buf, 1, chunk, out) != chunk) {
- debug_print(1, ("fwrite() returned short byte count\n"));
return -1;
}
size -= chunk;