umid.c (e03c78ac2d7709b7556a9b8dd584e2969c6fce67) | umid.c (0936d4f3d5a3d5daf453bc341f02ba4e68cfe40e) |
---|---|
1/* 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 3 * Licensed under the GPL 4 */ 5 6#include <stdio.h> 7#include <stdlib.h> 8#include <dirent.h> --- 340 unchanged lines hidden (view full) --- 349char *get_umid(void) 350{ 351 return umid; 352} 353 354static int __init set_uml_dir(char *name, int *add) 355{ 356 if (*name == '\0') { | 1/* 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 3 * Licensed under the GPL 4 */ 5 6#include <stdio.h> 7#include <stdlib.h> 8#include <dirent.h> --- 340 unchanged lines hidden (view full) --- 349char *get_umid(void) 350{ 351 return umid; 352} 353 354static int __init set_uml_dir(char *name, int *add) 355{ 356 if (*name == '\0') { |
357 printf("uml_dir can't be an empty string\n"); | 357 os_warn("uml_dir can't be an empty string\n"); |
358 return 0; 359 } 360 361 if (name[strlen(name) - 1] == '/') { 362 uml_dir = name; 363 return 0; 364 } 365 366 uml_dir = malloc(strlen(name) + 2); 367 if (uml_dir == NULL) { | 358 return 0; 359 } 360 361 if (name[strlen(name) - 1] == '/') { 362 uml_dir = name; 363 return 0; 364 } 365 366 uml_dir = malloc(strlen(name) + 2); 367 if (uml_dir == NULL) { |
368 printf("Failed to malloc uml_dir - error = %d\n", errno); | 368 os_warn("Failed to malloc uml_dir - error = %d\n", errno); |
369 370 /* 371 * Return 0 here because do_initcalls doesn't look at 372 * the return value. 373 */ 374 return 0; 375 } 376 sprintf(uml_dir, "%s/", name); --- 8 unchanged lines hidden (view full) --- 385 386static void remove_umid_dir(void) 387{ 388 char dir[strlen(uml_dir) + UMID_LEN + 1], err; 389 390 sprintf(dir, "%s%s", uml_dir, umid); 391 err = remove_files_and_dir(dir); 392 if (err) | 369 370 /* 371 * Return 0 here because do_initcalls doesn't look at 372 * the return value. 373 */ 374 return 0; 375 } 376 sprintf(uml_dir, "%s/", name); --- 8 unchanged lines hidden (view full) --- 385 386static void remove_umid_dir(void) 387{ 388 char dir[strlen(uml_dir) + UMID_LEN + 1], err; 389 390 sprintf(dir, "%s%s", uml_dir, umid); 391 err = remove_files_and_dir(dir); 392 if (err) |
393 printf("remove_umid_dir - remove_files_and_dir failed with " 394 "err = %d\n", err); | 393 os_warn("%s - remove_files_and_dir failed with err = %d\n", 394 __func__, err); |
395} 396 397__uml_exitcall(remove_umid_dir); | 395} 396 397__uml_exitcall(remove_umid_dir); |