diff options
author | Tony Lindgren <tony@atomide.com> | 2012-11-13 16:25:38 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-11-13 16:25:38 -0500 |
commit | 89ab216b33ba9405880fd3d89531305a931bc70f (patch) | |
tree | 8f6428ce51ecaed6f6e1379c036dbe341eb71e34 /usr/gen_init_cpio.c | |
parent | c9d501e5cb0238910337213e12a09127221c35d8 (diff) | |
parent | 46bf4a562207c5ebd24e1dde5e5ee326cd3d6b91 (diff) |
Merge branch 'omap-for-v3.8/pm' into omap-for-v3.8/clock
Diffstat (limited to 'usr/gen_init_cpio.c')
-rw-r--r-- | usr/gen_init_cpio.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index af0f22fb1ef7..aca6edcbbc6f 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c | |||
@@ -303,7 +303,7 @@ static int cpio_mkfile(const char *name, const char *location, | |||
303 | int retval; | 303 | int retval; |
304 | int rc = -1; | 304 | int rc = -1; |
305 | int namesize; | 305 | int namesize; |
306 | int i; | 306 | unsigned int i; |
307 | 307 | ||
308 | mode |= S_IFREG; | 308 | mode |= S_IFREG; |
309 | 309 | ||
@@ -381,25 +381,28 @@ error: | |||
381 | 381 | ||
382 | static char *cpio_replace_env(char *new_location) | 382 | static char *cpio_replace_env(char *new_location) |
383 | { | 383 | { |
384 | char expanded[PATH_MAX + 1]; | 384 | char expanded[PATH_MAX + 1]; |
385 | char env_var[PATH_MAX + 1]; | 385 | char env_var[PATH_MAX + 1]; |
386 | char *start; | 386 | char *start; |
387 | char *end; | 387 | char *end; |
388 | 388 | ||
389 | for (start = NULL; (start = strstr(new_location, "${")); ) { | 389 | for (start = NULL; (start = strstr(new_location, "${")); ) { |
390 | end = strchr(start, '}'); | 390 | end = strchr(start, '}'); |
391 | if (start < end) { | 391 | if (start < end) { |
392 | *env_var = *expanded = '\0'; | 392 | *env_var = *expanded = '\0'; |
393 | strncat(env_var, start + 2, end - start - 2); | 393 | strncat(env_var, start + 2, end - start - 2); |
394 | strncat(expanded, new_location, start - new_location); | 394 | strncat(expanded, new_location, start - new_location); |
395 | strncat(expanded, getenv(env_var), PATH_MAX); | 395 | strncat(expanded, getenv(env_var), |
396 | strncat(expanded, end + 1, PATH_MAX); | 396 | PATH_MAX - strlen(expanded)); |
397 | strncpy(new_location, expanded, PATH_MAX); | 397 | strncat(expanded, end + 1, |
398 | } else | 398 | PATH_MAX - strlen(expanded)); |
399 | break; | 399 | strncpy(new_location, expanded, PATH_MAX); |
400 | } | 400 | new_location[PATH_MAX] = 0; |
401 | 401 | } else | |
402 | return new_location; | 402 | break; |
403 | } | ||
404 | |||
405 | return new_location; | ||
403 | } | 406 | } |
404 | 407 | ||
405 | 408 | ||