[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] adduser remove some code
From: Harald Becker <ralda () gmx ! de>
Date: 2013-12-21 16:22:36
Message-ID: 20131221172236.1169dc37 () ralda ! gmx ! de
[Download RAW message or body]
Hi Tito !
>So I would simplify the code like:
>
> opt_complementary = "-1:?2:SD:u+";
> opts = getopt32(argv, "h:g:s:G:DSHu:", &pw.pw_dir,
> &pw.pw_gecos, &pw.pw_shell, &usegroup, &pw.pw_uid);
IMO you miss one fact. The field pw.pw_uid (especially) is
different size and type on different systems/libraries
(sometimes only 16 bit data type). I think getopt32 expects
pointer to an integer or unsigned data type. Writing to 16 bit
data type using a pointer to int would write to unknown location.
Better to use a local variable, and let the compiler do the type
mangling:
unsigned uid;
... getopt32( ..., &uid);
pw.pw_uid = uid;
But nevertheless you are right, the code parts shall be merged.
--
Harald
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic