From patchwork Sat Oct 12 20:46:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: angelo X-Patchwork-Id: 283015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 73FDE2C035B for ; Sun, 13 Oct 2013 07:46:37 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CEBC38C015; Sat, 12 Oct 2013 20:46:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HeecrY-qU5Or; Sat, 12 Oct 2013 20:46:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id F421E8BE5D; Sat, 12 Oct 2013 20:46:34 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id AEBAD1BFAAE for ; Sat, 12 Oct 2013 20:46:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A8BBA8BE5D for ; Sat, 12 Oct 2013 20:46:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OnW4zd6mK8Gq for ; Sat, 12 Oct 2013 20:46:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by whitealder.osuosl.org (Postfix) with ESMTPS id C019F8BE4B for ; Sat, 12 Oct 2013 20:46:32 +0000 (UTC) Received: by mail-ee0-f51.google.com with SMTP id c1so2581173eek.10 for ; Sat, 12 Oct 2013 13:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=mWKa2tpsE4r7r8+h6Hp+T1Bc09ihL0RQZKswns5nJdA=; b=AyPa2sy/HwGxoUpId4akvWELmmoTesQWNBoLRNhPs0fF4ECZTtl79ZAf1b/ZB8g59x G0uxwsZq5nClERSWCa5SM25qtk0Jtz4gc0On56ZgEqZ4d8hAM3A8G9Xe8HIyhc72pwMi nxCa96YV2LYnt29yipNXTTIjCCNKfvOGm0G/ndxmBlRX9bzcSIsol098B4iKhcPPXDM+ i2NaiQHUCzN0Ob8jfO88fBiQse5Sy9iNSiJ5weTRaFUks20l1fuggy8Fe7EhRxzvCDcX R4+zWyf0Sn2iS69Y4xSCO/0/BC/ZQCPqLUyOh6ahUGFTAZ0sV4mYbew+8US0esHQ6Ke/ r5Hg== X-Received: by 10.14.45.70 with SMTP id o46mr41139427eeb.19.1381610791235; Sat, 12 Oct 2013 13:46:31 -0700 (PDT) Received: from jerusalem.sysam.it (host249-234-dynamic.0-87-r.retail.telecomitalia.it. [87.0.234.249]) by mx.google.com with ESMTPSA id d8sm131823223eeh.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 12 Oct 2013 13:46:30 -0700 (PDT) Received: from devel by jerusalem.sysam.it with local (Exim 4.80) (envelope-from ) id 1VV64z-0002fl-9I; Sat, 12 Oct 2013 22:46:29 +0200 From: angelo70@gmail.com To: buildroot@busybox.net Date: Sat, 12 Oct 2013 22:46:17 +0200 Message-Id: <1381610777-10239-1-git-send-email-angelo70@gmail.com> X-Mailer: git-send-email 1.8.4.rc3 Cc: Angelo Dureghello Subject: [Buildroot] [PATCH] package/makedevs: add "l" type for symlinks ownership change X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: Angelo Dureghello Add to makedevs the 'l' type, to allow symlinks ownership change. Add related change on the makedevs doc. Singed-off-by: Angelo Dureghello --- docs/manual/makedev-syntax.txt | 1 + package/makedevs/makedevs.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/docs/manual/makedev-syntax.txt b/docs/manual/makedev-syntax.txt index 2c98531..2392dc1 100644 --- a/docs/manual/makedev-syntax.txt +++ b/docs/manual/makedev-syntax.txt @@ -27,6 +27,7 @@ There are a few non-trivial blocks here: * c: a character device file * b: a block device file * p: a named pipe + * l: a symbolic link, for ownership changes only - +mode+, +uid+ and +gid+ are the usual permissions settings - +major+ and +minor+ are here for device files - set to - for other files diff --git a/package/makedevs/makedevs.c b/package/makedevs/makedevs.c index ab90b93..026533e 100644 --- a/package/makedevs/makedevs.c +++ b/package/makedevs/makedevs.c @@ -474,6 +474,18 @@ int main(int argc, char **argv) ret = EXIT_FAILURE; goto loop; } + } else if (type == 'l') { + struct stat st; + if ((lstat(full_name, &st) < 0 || !S_ISLNK(st.st_mode))) { + bb_perror_msg("line %d: invalid link for %s", linenum, full_name); + ret = EXIT_FAILURE; + goto loop; + } + if (lchown(full_name, uid, gid) == -1) { + bb_perror_msg("line %d: chown failed for %s", linenum, full_name); + ret = EXIT_FAILURE; + goto loop; + } } else { dev_t rdev;