diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-12-30 13:00:29 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-12-30 13:00:29 -0500 |
commit | d0e254663e64e40b676644038a9d7c95a2f25116 (patch) | |
tree | 193b9d0f5b58436b2ecbcb4762327c8560831a2b /src/fs.c | |
parent | 4595ada2f69b42670c85a63c7d2344af63f2afe7 (diff) | |
download | spmc-d0e254663e64e40b676644038a9d7c95a2f25116.tar.gz |
Fix inane compiler warnings
* fix rpath_set
* add rpath_autoset
* add internal command "rpath_set"
Diffstat (limited to 'src/fs.c')
-rw-r--r-- | src/fs.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -168,7 +168,7 @@ char *expandpath(const char *_path) { strchrdel(ptmp, "~"); // Figure out where the user's home directory resides - for (int i = 0; i < sizeof(homes); i++) { + for (size_t i = 0; i < sizeof(homes); i++) { char *tmphome; if ((tmphome = getenv(homes[i])) != NULL) { strncpy(home, tmphome, strlen(tmphome)); @@ -286,16 +286,15 @@ int rsync(const char *_args, const char *_source, const char *_destination) { char *source = strdup(_source); char *destination = strdup(_destination); char cmd[PATH_MAX]; - char args_combined[PATH_MAX]; + char *args_combined = (char *)calloc(PATH_MAX, sizeof(char)); memset(cmd, '\0', sizeof(cmd)); - memset(args_combined, '\0', sizeof(args_combined)); strcpy(args_combined, "--archive --hard-links "); if (args) { strcat(args_combined, _args); } - sprintf(cmd, "rsync %s \"%s\" \"%s\"", args_combined, source, destination); + snprintf(cmd, PATH_MAX, "rsync %s \"%s\" \"%s\"", args_combined, source, destination); // sanitize command strchrdel(cmd, "&;|"); shell(&proc, SHELL_OUTPUT, cmd); @@ -402,7 +401,7 @@ int exists(const char *filename) { * @return string */ char *human_readable_size(uint64_t n) { - int i; + size_t i; double result = (double)n; char *unit[] = {"B", "K", "M", "G", "T", "P", "E"}; char r[255]; |