aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/umid.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/umid.c')
-rw-r--r--arch/um/kernel/umid.c11
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)
237 strlcpy(dir, home, sizeof(dir)); 237 strlcpy(dir, home, sizeof(dir));
238 uml_dir++; 238 uml_dir++;
239 } 239 }
240 strlcat(dir, uml_dir, sizeof(dir));
240 len = strlen(dir); 241 len = strlen(dir);
241 strncat(dir, uml_dir, sizeof(dir) - len); 242 if (len > 0 && dir[len - 1] != '/')
242 len = strlen(dir); 243 strlcat(dir, "/", sizeof(dir));
243 if((len > 0) && (len < sizeof(dir) - 1) && (dir[len - 1] != '/')){
244 dir[len] = '/';
245 dir[len + 1] = '\0';
246 }
247 244
248 uml_dir = malloc(strlen(dir) + 1); 245 uml_dir = malloc(strlen(dir) + 1);
249 if(uml_dir == NULL){ 246 if (uml_dir == NULL) {
250 printf("make_uml_dir : malloc failed, errno = %d\n", errno); 247 printf("make_uml_dir : malloc failed, errno = %d\n", errno);
251 exit(1); 248 exit(1);
252 } 249 }