svn commit: r228616 - head/usr.bin/tar

Kostik Belousov kostikbel at gmail.com
Sat Dec 17 08:34:13 UTC 2011


On Sat, Dec 17, 2011 at 01:36:51AM +0000, Dimitry Andric wrote:
> Author: dim
> Date: Sat Dec 17 01:36:50 2011
> New Revision: 228616
> URL: http://svn.freebsd.org/changeset/base/228616
> 
> Log:
>   In usr.bin/tar/tree.c, if you really want to poke to NULL, you must use
>   volatile, otherwise the indirection will not be emitted.
>   
>   MFC after:	1 week
> 
> Modified:
>   head/usr.bin/tar/tree.c
> 
> Modified: head/usr.bin/tar/tree.c
> ==============================================================================
> --- head/usr.bin/tar/tree.c	Sat Dec 17 01:29:46 2011	(r228615)
> +++ head/usr.bin/tar/tree.c	Sat Dec 17 01:36:50 2011	(r228616)
> @@ -315,7 +315,7 @@ tree_next(struct tree *t)
>  		const char *msg = "Unable to continue traversing"
>  		    " directory hierarchy after a fatal error.";
>  		write(2, msg, strlen(msg));
> -		*(int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */
> +		*(volatile int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */
>  		exit(1); /* In case the SEGV didn't work. */
>  	}
>  
Why this hack is used instead of abort(3) or abort2(2) ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20111217/c1fadfed/attachment.pgp


More information about the svn-src-head mailing list