Skip to content

Commit

Permalink
Fix printf-format warnings and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Aug 23, 2022
1 parent 7508c9c commit 80b0d48
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cmirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static struct FileInfo *fileinfo_lstat(char *path) {
fi->target = g_malloc(sb.st_size + 1);
int res = readlink(path, fi->target, sb.st_size+1);
if (res == -1)
die("readlink %s: %M\n", path);
die("readlink %s: %m\n", path);
if (res > sb.st_size)
die("readlink %s: target string to long\n", path);
fi->target[res] = '\0';
Expand Down Expand Up @@ -302,7 +302,7 @@ static char data_buffer[10240+2];

static void fileop_mknod(char *path, char type, dev_t rdev) {
if (fileop_debug)
warn("fileop: mknod %s %c %d\n", path, type, rdev);
warn("fileop: mknod %s %c %lu\n", path, type, rdev);
if (fileop_noop)
return;
mode_t mode;
Expand Down Expand Up @@ -410,7 +410,7 @@ static void fileop_lchown(uid_t uid, gid_t gid, char *path) {

static void fileop_lmtime(time_t mtime, char *path) {
if (fileop_debug)
warn("fileop: lmtime %d %s\n", mtime, path);
warn("fileop: lmtime %ld %s\n", mtime, path);
if (fileop_noop)
return;
struct timespec timespec[2] = { { 0, UTIME_OMIT } , { mtime, 0 } };
Expand Down Expand Up @@ -501,7 +501,7 @@ static void add_clean_dir(char *dir) {
GError *error;
GDir *d = g_dir_open(dir, 0, &error);
if (!d)
die("%s %s\n", error->message);
die("%s: %s\n", dir, error->message);
const char *entry;
while ( (entry = g_dir_read_name(d)) ) {
char *path = g_strdup_printf("%s/%s", dir, entry);
Expand Down Expand Up @@ -544,10 +544,10 @@ static ssize_t receive_record(FILE *in, char *buffer, size_t buflen) {
return 0;
unsigned int len = ntohs(*(uint16_t *)b);
if (len > buflen)
die("data overrun %d > %d\n", len, buflen);
die("data overrun %u > %lu\n", len, buflen);
size_t l2 = fread(buffer, 1, len, in);
if (l2 != len)
die("data underrun %d != %d\n", l1, l2);
die("data underrun %lu != %lu\n", l1, l2);
return len;
}

Expand All @@ -565,7 +565,7 @@ static void receive_file(FILE *in, char *filename, off_t expected_size, mode_t p
if(l2 == -1)
die("%s: %m\n", filename);
if (l2 != l1)
die("%s: short write\n");
die("%s: short write\n", filename);
expected_size -= l2;
}
fdatasync(fd);
Expand Down Expand Up @@ -916,7 +916,7 @@ static void slave(char *slave_path) {
GSList *d = CLEAN_DIRS;
while (d) {
if (!quiet)
warn("rm -r %s\n", d->data);
warn("rm -r %s\n", (char *)d->data);
d = d->next;
}
}
Expand All @@ -937,7 +937,7 @@ static void slave(char *slave_path) {
if (statbuf.st_mtime == mt->mtime)
continue;
if (!quiet)
warn("fix directory mtime of %s -> %d\n", mt->path, mt->mtime);
warn("fix directory mtime of %s -> %ld\n", mt->path, mt->mtime);
if (!fileop_noop) {
struct timespec timespec[2] = { { 0, UTIME_OMIT } , { mt->mtime, 0 } };
if (utimensat(AT_FDCWD, mt->path, timespec, AT_SYMLINK_NOFOLLOW) == -1)
Expand Down Expand Up @@ -1257,7 +1257,7 @@ static void master(char *master_path, char *target) {
unsetenv("SSH_ORIGINAL_COMMAND");

execvp(args->pdata[0], (char **)args->pdata);
die("exec %s: %m\n", args->pdata[0]);
die("exec %s: %m\n", (char *)args->pdata[0]);
}
else if (pid == -1)
die("fork: %m");
Expand Down

0 comments on commit 80b0d48

Please sign in to comment.