diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2024-10-04 08:40:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-04 08:40:39 -0400 |
commit | d7e3deba72703ad36c497f5becf6772ca00a0d6d (patch) | |
tree | eff3b2ec3dcc31126041529c8e00a714997f2d7b /src/stasis_indexer.c | |
parent | 9691ccf51b3efd8113e9620c4afa8b5382d7f161 (diff) | |
parent | f0ba8cd378a460f927644e41f49be95d0e956f81 (diff) | |
download | stasis-d7e3deba72703ad36c497f5becf6772ca00a0d6d.tar.gz |
Merge pull request #46 from jhunkeler/split-delivery-code
Add multiprocessing / Split delivery code
Diffstat (limited to 'src/stasis_indexer.c')
-rw-r--r-- | src/stasis_indexer.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/stasis_indexer.c b/src/stasis_indexer.c index ef6375b..b38c8d0 100644 --- a/src/stasis_indexer.c +++ b/src/stasis_indexer.c @@ -72,9 +72,9 @@ int indexer_combine_rootdirs(const char *dest, char **rootdirs, const size_t roo if (!access(srcdir_with_output, F_OK)) { srcdir = srcdir_with_output; } - sprintf(cmd + strlen(cmd), "'%s'/ ", srcdir); + snprintf(cmd + strlen(cmd), sizeof(srcdir) - strlen(srcdir) + 4, "'%s'/ ", srcdir); } - sprintf(cmd + strlen(cmd), "%s/", destdir); + snprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(destdir) + 1, " %s/", destdir); if (globals.verbose) { puts(cmd); @@ -368,6 +368,8 @@ int indexer_make_website(struct Delivery *ctx) { // This might be negative when killed by a signal. // Otherwise, the return code is not critical to us. if (system(cmd) < 0) { + guard_free(css_filename); + guard_strlist_free(&dirs); return 1; } if (file_replace_text(fullpath_dest, ".md", ".html", 0)) { @@ -381,11 +383,14 @@ int indexer_make_website(struct Delivery *ctx) { char link_dest[PATH_MAX] = {0}; strcpy(link_from, "README.html"); sprintf(link_dest, "%s/%s", root, "index.html"); - symlink(link_from, link_dest); + if (symlink(link_from, link_dest)) { + SYSERROR("Warning: symlink(%s, %s) failed: %s", link_from, link_dest, strerror(errno)); + } } } guard_strlist_free(&inputs); } + guard_free(css_filename); guard_strlist_free(&dirs); return 0; |