[PATCH] umount: always use umount2 syscall with specified flags

Sam Liddicott sam at liddicott.com
Mon Oct 5 13:23:51 UTC 2015


Some discussion on better encapsulations of the technique here:
http://stackoverflow.com/questions/174356/ways-to-assert-expressions-at-build-time-in-c

Sam

On Sat, Oct 3, 2015 at 11:58 AM, Xabier Oneca -- xOneca <xoneca at gmail.com>
wrote:

> Hello,
>
> Excuse my ignorance, but what does this typedef do?
>
> ------------------
>     {
>         typedef char bug[
>             (OPT_FORCE != MNT_FORCE || OPT_LAZY != MNT_DETACH) ? -1 : 1
>         ];
>     }
> ------------------
>
> My understanding is that this snippet catches when those two constants
> are not equal and then trigger a compiler error by defining a char[-1]
> type. Am I correct? If so, why isn't used the preprocessor #errror
> with a less cryptic error description?
>
> In a test I did:
>
> ------------------
>     test.c: In function ‘main’:
>     test.c:9:18: error: size of array ‘bug’ is negative
>          typedef char bug[
>                       ^
> ------------------
>
> The bug is not so obvious to identify until you inspect the source code...
>
> Thanks!
>
> Xabier Oneca_,,_
>
> 2015-10-01 18:52 GMT+02:00 Denys Vlasenko <vda.linux at googlemail.com>:
> > Applied, thanks!
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20151005/30de0d78/attachment.html>


More information about the busybox mailing list