summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNora Schiffer2026-02-09 23:30:35 +0000
committerNora Schiffer2026-02-20 21:55:58 +0000
commit4e4a34b1a833505ad274d973b3e86c8b5ebcdd8d (patch)
tree1f9f28768a3b14d3b717535857adb12ec2906a18
parent180ffccf79d1a1a2c3eb644e26f6d87b1cbcfffd (diff)
rcS, ubus: constify char * arguments and variables where appropriate
Signed-off-by: Nora Schiffer <neocturne@universe-factory.net>
-rw-r--r--procd.h2
-rw-r--r--rcS.c10
-rw-r--r--rcS.h4
-rw-r--r--ubus.c2
4 files changed, 9 insertions, 9 deletions
diff --git a/procd.h b/procd.h
index c656d3b..f48edeb 100644
--- a/procd.h
+++ b/procd.h
@@ -27,7 +27,7 @@
#define __init __attribute__((constructor))
-extern char *ubus_socket;
+extern const char *ubus_socket;
void procd_connect_ubus(void);
void procd_reconnect_ubus(int reconnect);
diff --git a/rcS.c b/rcS.c
index bfaf50b..45a96a9 100644
--- a/rcS.c
+++ b/rcS.c
@@ -125,7 +125,7 @@ static void q_initd_complete(struct runqueue *q, struct runqueue_task *p)
free(s);
}
-static bool find_runqueue_list_entry(struct list_head *list, char *file, char *param)
+static bool find_runqueue_list_entry(struct list_head *list, const char *file, const char *param)
{
struct initd *s;
@@ -135,7 +135,7 @@ static bool find_runqueue_list_entry(struct list_head *list, char *file, char *p
return false;
}
-static void add_initd(struct runqueue *q, char *file, char *param)
+static void add_initd(struct runqueue *q, const char *file, const char *param)
{
static const struct runqueue_task_type initd_type = {
.run = q_initd_run,
@@ -168,7 +168,7 @@ static void add_initd(struct runqueue *q, char *file, char *param)
runqueue_task_add(q, &s->proc.task, false);
}
-static int _rc(struct runqueue *q, char *path, const char *file, char *pattern, char *param)
+static int _rc(struct runqueue *q, const char *path, const char *file, const char *pattern, const char *param)
{
char *dir = alloca(2 + strlen(path) + strlen(file) + strlen(pattern));
glob_t gl;
@@ -194,7 +194,7 @@ static int _rc(struct runqueue *q, char *path, const char *file, char *pattern,
return 0;
}
-int rcS(char *pattern, char *param, void (*q_empty)(struct runqueue *))
+int rcS(const char *pattern, const char *param, void (*q_empty)(struct runqueue *))
{
runqueue_init(&q);
q.empty_cb = q_empty;
@@ -203,7 +203,7 @@ int rcS(char *pattern, char *param, void (*q_empty)(struct runqueue *))
return _rc(&q, "/etc/rc.d", pattern, "*", param);
}
-int rc(const char *file, char *param)
+int rc(const char *file, const char *param)
{
return _rc(&r, "/etc/init.d", file, "", param);
}
diff --git a/rcS.h b/rcS.h
index 91d37d1..9b6bb84 100644
--- a/rcS.h
+++ b/rcS.h
@@ -17,7 +17,7 @@
#include <libubox/runqueue.h>
-extern int rcS(char *pattern, char *param, void (*q_empty)(struct runqueue *));
-extern int rc(const char *file, char *param);
+extern int rcS(const char *pattern, const char *param, void (*q_empty)(struct runqueue *));
+extern int rc(const char *file, const char *param);
#endif
diff --git a/ubus.c b/ubus.c
index b0b7c9a..23f640a 100644
--- a/ubus.c
+++ b/ubus.c
@@ -19,7 +19,7 @@
#include "procd.h"
-char *ubus_socket = NULL;
+const char *ubus_socket = NULL;
static struct ubus_context *ctx;
static struct uloop_timeout ubus_timer;
static int timeout;