Replace a malloc+strcpy by an equivalent strdup in order to improve
readability.
Turn a some spaces into a tab to be consistent with the rest of the code.

Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr>
---
 arch/um/os-Linux/umid.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index c1dc892..cc9ac2e 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -48,15 +48,14 @@ static int __init make_uml_dir(void)
                strlcat(dir, "/", sizeof(dir));
 
        err = -ENOMEM;
-       uml_dir = malloc(strlen(dir) + 1);
+       uml_dir = strdup(dir);
        if (uml_dir == NULL) {
-               printf("make_uml_dir : malloc failed, errno = %d\n", errno);
+               printf("make_uml_dir : strdup failed, errno = %d\n", errno);
                goto err;
        }
-       strcpy(uml_dir, dir);
 
        if ((mkdir(uml_dir, 0777) < 0) && (errno != EEXIST)) {
-               printf("Failed to mkdir '%s': %s\n", uml_dir, strerror(errno));
+               printf("Failed to mkdir '%s': %s\n", uml_dir, strerror(errno));
                err = -errno;
                goto err_free;
        }
-- 
2.1.4


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to