aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-05-02 00:44:56 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-05-02 00:44:56 -0400
commitd4ff44ab8db091ca0e7d1c8caa74f32784e672ef (patch)
treef68168dcc1be1594037223010fc916fc73eca7cf
parenta970d40094aca5ce43e3bf91b9a5a2323c41ead8 (diff)
downloadstasis-d4ff44ab8db091ca0e7d1c8caa74f32784e672ef.tar.gz
Move listdir to utils.c and export prototype
-rw-r--r--include/utils.h3
-rw-r--r--src/deliverable.c21
-rw-r--r--src/utils.c21
3 files changed, 24 insertions, 21 deletions
diff --git a/include/utils.h b/include/utils.h
index 37ba50a..43bb618 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -308,4 +308,7 @@ char *collapse_whitespace(char **s);
* @return 0 on success, -1 on error
*/
int redact_sensitive(const char **to_redact, char *src, char *dest, size_t maxlen);
+
+struct StrList *listdir(const char *path);
+
#endif //OMC_UTILS_H
diff --git a/src/deliverable.c b/src/deliverable.c
index dbbaecb..4318f53 100644
--- a/src/deliverable.c
+++ b/src/deliverable.c
@@ -1293,27 +1293,6 @@ int delivery_copy_wheel_artifacts(struct Delivery *ctx) {
return system(cmd);
}
-static struct StrList *listdir(const char *path) {
- struct StrList *node;
- DIR *dp;
- struct dirent *rec;
-
- dp = opendir(path);
- if (!dp) {
- return NULL;
- }
- node = strlist_init();
-
- while ((rec = readdir(dp)) != NULL) {
- if (!strcmp(rec->d_name, ".") || !strcmp(rec->d_name, "..")) {
- continue;
- }
- strlist_append(&node, rec->d_name);
- }
- closedir(dp);
- return node;
-}
-
int delivery_index_wheel_artifacts(struct Delivery *ctx) {
struct dirent *rec;
DIR *dp;
diff --git a/src/utils.c b/src/utils.c
index c1f78e5..a4230d3 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -712,3 +712,24 @@ int redact_sensitive(const char **to_redact, char *src, char *dest, size_t maxle
return 0;
}
+struct StrList *listdir(const char *path) {
+ struct StrList *node;
+ DIR *dp;
+ struct dirent *rec;
+
+ dp = opendir(path);
+ if (!dp) {
+ return NULL;
+ }
+ node = strlist_init();
+
+ while ((rec = readdir(dp)) != NULL) {
+ if (!strcmp(rec->d_name, ".") || !strcmp(rec->d_name, "..")) {
+ continue;
+ }
+ strlist_append(&node, rec->d_name);
+ }
+ closedir(dp);
+ return node;
+}
+