diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2005-09-22 21:44:14 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-22 22:17:36 -0700 |
commit | a8bfb94c58238666df0d6856861d18f0f52fc752 (patch) | |
tree | ff22df262edafd55c9004a32a25dfb818c0841a9 /arch/um/kernel/umid.c | |
parent | 3a02d6c051cf3c214aab38e4330b4bcec5f6e3f8 (diff) | |
download | linux-a8bfb94c58238666df0d6856861d18f0f52fc752.tar.bz2 |
[PATCH] strlcat: use for uml umid.c
Simplify the code by using strlcat() instead of strncat() and manual
appending.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel/umid.c')
-rw-r--r-- | arch/um/kernel/umid.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/um/kernel/umid.c b/arch/um/kernel/umid.c index 251d277fff2a..0b21d59ba0cd 100644 --- a/arch/um/kernel/umid.c +++ b/arch/um/kernel/umid.c @@ -237,16 +237,13 @@ static int __init make_uml_dir(void) strlcpy(dir, home, sizeof(dir)); uml_dir++; } + strlcat(dir, uml_dir, sizeof(dir)); len = strlen(dir); - strncat(dir, uml_dir, sizeof(dir) - len); - len = strlen(dir); - if((len > 0) && (len < sizeof(dir) - 1) && (dir[len - 1] != '/')){ - dir[len] = '/'; - dir[len + 1] = '\0'; - } + if (len > 0 && dir[len - 1] != '/') + strlcat(dir, "/", sizeof(dir)); uml_dir = malloc(strlen(dir) + 1); - if(uml_dir == NULL){ + if (uml_dir == NULL) { printf("make_uml_dir : malloc failed, errno = %d\n", errno); exit(1); } |