aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2015-08-21 14:24:30 -0500
committerPeter Seebach <peter.seebach@windriver.com>2015-08-21 14:24:30 -0500
commit6dd828b9f9bd03f47167feb6c017e44e1898f6ed (patch)
tree941988402a6a88cf84f1b6e40bf68335b5a5aa30
parent35d5b50b64b91c580b3cf1462fe9e9560d96b69d (diff)
downloadpseudo-6dd828b9f9bd03f47167feb6c017e44e1898f6ed.tar.gz
pseudo-6dd828b9f9bd03f47167feb6c017e44e1898f6ed.tar.bz2
pseudo-6dd828b9f9bd03f47167feb6c017e44e1898f6ed.zip
Clean up some const stuff
Dropping the alloc from file paths meant that pseudo_exec_path could end up just returning its original argument, which was const-qualified, meaning its return should also be const-qualified. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
-rw-r--r--ports/common/guts/execv.c2
-rw-r--r--ports/common/guts/execve.c2
-rw-r--r--ports/common/guts/execvp.c2
-rw-r--r--pseudo_client.c2
-rw-r--r--pseudo_client.h2
5 files changed, 5 insertions, 5 deletions
diff --git a/ports/common/guts/execv.c b/ports/common/guts/execv.c
index d5dc3b0..ba1ce65 100644
--- a/ports/common/guts/execv.c
+++ b/ports/common/guts/execv.c
@@ -13,7 +13,7 @@
* design will likely be revisited.
*/
if (antimagic == 0) {
- char *path_guess = pseudo_exec_path(file, 0);
+ const char *path_guess = pseudo_exec_path(file, 0);
pseudo_client_op(OP_EXEC, PSA_EXEC, -1, -1, path_guess, 0);
}
diff --git a/ports/common/guts/execve.c b/ports/common/guts/execve.c
index 22d07a2..24cc177 100644
--- a/ports/common/guts/execve.c
+++ b/ports/common/guts/execve.c
@@ -14,7 +14,7 @@
* design will likely be revisited.
*/
if (antimagic == 0) {
- char *path_guess = pseudo_exec_path(file, 0);
+ const char *path_guess = pseudo_exec_path(file, 0);
pseudo_client_op(OP_EXEC, PSA_EXEC, -1, -1, path_guess, 0);
}
diff --git a/ports/common/guts/execvp.c b/ports/common/guts/execvp.c
index b30705d..e6bf09f 100644
--- a/ports/common/guts/execvp.c
+++ b/ports/common/guts/execvp.c
@@ -14,7 +14,7 @@
* design will likely be revisited.
*/
if (antimagic == 0) {
- char *path_guess = pseudo_exec_path(file, 1);
+ const char *path_guess = pseudo_exec_path(file, 1);
pseudo_client_op(OP_EXEC, PSA_EXEC, -1, -1, path_guess, 0);
}
diff --git a/pseudo_client.c b/pseudo_client.c
index 128be50..8581c85 100644
--- a/pseudo_client.c
+++ b/pseudo_client.c
@@ -1872,7 +1872,7 @@ populate_path_segs(void) {
path_lens[c] = 0;
}
-char *
+const char *
pseudo_exec_path(const char *filename, int search_path) {
char *path = getenv("PATH");
char *candidate;
diff --git a/pseudo_client.h b/pseudo_client.h
index 5bf820e..9fcb2f5 100644
--- a/pseudo_client.h
+++ b/pseudo_client.h
@@ -62,7 +62,7 @@ extern FILE *pseudo_grp;
extern int pseudo_client_getcwd(void);
extern int pseudo_client_chroot(const char *);
extern char *pseudo_root_path(const char *, int, int, const char *, int);
-extern char *pseudo_exec_path(const char *filename, int);
+extern const char *pseudo_exec_path(const char *filename, int);
#define PSEUDO_ROOT_PATH(x, y, z) pseudo_root_path(__func__, __LINE__, (x), (y), (z));
extern char *pseudo_cwd;
extern size_t pseudo_cwd_len;