libselinux utilities applets - please test

Denis Vlasenko vda.linux at googlemail.com
Tue Feb 6 19:29:32 UTC 2007


int getsebool_main(int argc, char **argv)
{
...
        if (!len) {
                if (argc < 2)
                        bb_show_usage();
                len = argc - 1;
                names = xmalloc(sizeof(char *) * len);
                for (i = 0; i < len; i++)
                        names[i] = xstrdup(argv[i + 1]);
        }

Is it necessary to allocate names and xstrdup argv[i]?
Maybe just do "names = argv + 1"?


bb_perror_msg_and_die("error while processing %s: ", prefix);

bb_perror prints: "<applet>: message: <strerror>" - that thrailing
": " in your code is not needed.


+#define matchpathcon_trivial_usage \
+       "[-n] [-N] [-f file_contexts_file] [-p prefix] [-V]"
+#define matchpathcon_full_usage \
+       "\t-n\tDo not display path.\n" \
+       "\t-N\tDo not use translations.\n" \
+       "\t-f\tfile_context_file Use alternate file_context file\n" \
+       "\t-p\tprefix Use prefix to speed translations\n" \
+       "\t-V\tVerify file context on disk matches defaults"

Ehhh.... usage.h has such a nice comment at the top:

/*
 * This file suffers from chronically incorrect tabification
 * of messages. Before editing this file:
 * 1. Switch you editor to 8-space tab mode.
 * 2. Do not use \t in messages, use real tab character.
 * 3. Start each source line with message as follows:
 *    |<7 spaces>"text with tabs"....
 */


Okay. I applied your patch to svn and did some changes.
Please review & test - I can't run-test it at the moment
(my kernel and userspace is not selinux-enabled).

Patch is attached for easy review. Thanks.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sl.patch
Type: text/x-diff
Size: 12760 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070206/cee881f2/attachment-0002.bin 


More information about the busybox mailing list