while ((n = read(fd, buf, sizeof(buf))) > 0) {
tp = Realloc(p, total + n + 1);
if (!tp) {
- DEBUG(0,("file_pload: failed to exand buffer!\n"));
+ DEBUG(0,("file_pload: failed to expand buffer!\n"));
close(fd);
SAFE_FREE(p);
return NULL;
}
if (p) p[total] = 0;
+ /* FIXME: Perhaps ought to check that the command completed
+ * successfully (returned 0); if not the data may be
+ * truncated. */
sys_pclose(fd);
if (size) *size = total;
#endif
if (!p) {
p = file_load(fname, &s2);
- if (!p || (s2 != 0 && s2 != size)) {
- DEBUG(1,("incorrect size for %s - got %d expected %d\n",
- fname, s2, size));
+ if (!p) return NULL;
+ if (s2 != size) {
+ DEBUG(1,("incorrect size for %s - got %lu expected %lu\n",
+ fname, (unsigned long)s2, (unsigned long)size));
if (p) free(p);
return NULL;
}
if (fd == -1) {
return False;
}
- if (write(fd, packet, length) != length) {
+ if (write(fd, packet, length) != (size_t)length) {
return False;
}
close(fd);