From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933287AbbGHTQ5 (ORCPT ); Wed, 8 Jul 2015 15:16:57 -0400 Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:37604 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932981AbbGHTQu (ORCPT ); Wed, 8 Jul 2015 15:16:50 -0400 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 08 Jul 2015 21:16:48 +0200 X-ME-IP: 92.140.216.36 From: Christophe JAILLET To: jdike@addtoit.com, richard@nod.at Cc: user-mode-linux-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] um: umid: Use strdup to simplify code Date: Wed, 8 Jul 2015 21:15:47 +0200 Message-Id: <1436382947-13181-1-git-send-email-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.1.4 X-Antivirus: avast! (VPS 150708-0, 08/07/2015), Outbound message X-Antivirus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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