aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_util.c
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2010-08-27 14:03:51 -0500
committerPeter Seebach <peter.seebach@windriver.com>2010-08-27 14:14:50 -0500
commitecab857a8a1bd332d6539370c0f183c2b4f004f6 (patch)
tree79af0b464f0fe9ec4d2a7eb26f63efb61277f53c /pseudo_util.c
parent6f8b09a6df61a547aa58d0748c0d1aba135d9b73 (diff)
downloadpseudo-ecab857a8a1bd332d6539370c0f183c2b4f004f6.tar.gz
pseudo-ecab857a8a1bd332d6539370c0f183c2b4f004f6.tar.bz2
pseudo-ecab857a8a1bd332d6539370c0f183c2b4f004f6.zip
We got bitten AGAIN by hard-coded lengths in memcmp, so we've swapped
that for a macro that does it correctly. Why not just use strcmp, you ask? Because we aren't doing a string compare, we're looking for a prefix.
Diffstat (limited to 'pseudo_util.c')
-rw-r--r--pseudo_util.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pseudo_util.c b/pseudo_util.c
index 6d66bd5..e2cabfe 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -624,7 +624,7 @@ pseudo_dropenvp(char * const *envp) {
j = 0;
for (i = 0; envp[i]; ++i) {
- if (!memcmp(envp[i], "LD_PRELOAD=", 11)) {
+ if (STARTSWITH(envp[i], "LD_PRELOAD=")) {
char *new_val = without_libpseudo(envp[i]);
if (!new_val) {
pseudo_diag("fatal: can't allocate new environment variable.\n");
@@ -632,7 +632,7 @@ pseudo_dropenvp(char * const *envp) {
} else {
/* don't keep an empty value; if the whole string is
* LD_PRELOAD=, we just drop it. */
- if (memcmp(new_val, "LD_PRELOAD=", 12)) {
+ if (strcmp(new_val, "LD_PRELOAD=")) {
new_envp[j++] = new_val;
}
}
@@ -725,10 +725,10 @@ pseudo_setupenvp(char * const *envp) {
free(pseudo_get_localstatedir());
for (i = 0; envp[i]; ++i) {
- if (!memcmp(envp[i], "LD_PRELOAD=", 11)) {
+ if (STARTSWITH(envp[i], "LD_PRELOAD=")) {
ld_preload = envp[i];
}
- if (!memcmp(envp[i], "LD_LIBRARY_PATH=", 11)) {
+ if (STARTSWITH(envp[i], "LD_LIBRARY_PATH=")) {
ld_library_path = envp[i];
}
++env_count;
@@ -784,8 +784,8 @@ pseudo_setupenvp(char * const *envp) {
free(libdir_path);
for (i = 0; envp[i]; ++i) {
- if (!memcmp(envp[i], "LD_PRELOAD=", 11)) continue;
- if (!memcmp(envp[i], "LD_LIBRARY_PATH=", 16)) continue;
+ if (STARTSWITH(envp[i], "LD_PRELOAD=")) continue;
+ if (STARTSWITH(envp[i], "LD_LIBRARY_PATH=")) continue;
new_envp[j++] = envp[i];
}