Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

gnushit

Name: Anonymous 2009-10-30 14:03

#include <unistd.h>
int main(int argc, char *argv[])
{
    return execl("/bin/true", NULL);
}

This makes GNU true segfault in a call to strrchr().

Name: Anonymous 2009-10-30 14:08

Then stop fucking using execl incorrectly.

Name: Anonymous 2009-10-30 14:21

int execl(const char *path, const char *arg, ...);
lol wat the fuck is this shit the number of arguments is not specified exactly reported to the anis/ecma committee for anus penalty

Name: Anonymous 2009-10-30 14:24

>>3
I almost HBT

Name: Shotgun Ninja 2009-10-30 14:37

>>3

vararg functions? You mean like printf()?

Just reimplement a virtual function table. Obviously. That'll TOTALLY work.

Name: Anonymous 2009-10-30 14:55

>>2
Then execl should fail, not true.

The bigger question is, why does true need to call strrchr in the first place?

Name: Anonymous 2009-10-30 14:59

>>6

because they're true bros. i'm from imageboards you see

Name: Anonymous 2009-10-30 15:03

>>7
then back to imageboards, please

Name: Anonymous 2009-10-30 16:01


konata@kagami:~$ cat /dev/tty testit.c
#include <unistd.h>
int main(int argc, char *argv[])
{
    return execl("/bin/true", NULL);
}
^Dkonata@kagami:~$ cc testit.c
konata@kagami:~$ ./a.out
konata@kagami:~$ echo $?
22
konata@kagami:~$ grep ' 22$' /usr/include/errno.h
#define EINVAL       22
konata@kagami:~$ uname -a
Anonix kagami 20090827 pre-3 IA32
konata@kagami:~$

Name: Anonymous 2009-10-30 16:24

>>9
I thought I was the only person sad enough to name their computer ``kagami'' ;_;

Name: Anonymous 2009-10-30 16:28

>>10
I thought I was the only person faggoty enough to name their computer ``kagami" ;_;
FTFY

Name: Anonymous 2009-10-30 18:06

>>9
/dev/tty
の_の

Name: Anonymous 2009-10-30 19:11

#include <unistd.h>
int main(int argc, char *argv[])
{
    path = "/bin/true";
    return execl(path, path);
}

hopeless. all of you.
don't you know that the argv[0] should be the name of the program?

Name: Anonymous 2009-10-30 20:44

>>12
That's a big no-no, if you know what I mean.

Name: Anonymous 2009-10-30 23:06

>>14

LOL

I 5t it

Name: Anonymous 2009-10-30 23:34

>>15
Oh anon, you card.

Name: Anonymous 2009-10-31 1:52

>>13
"Should", yes, technically speaking:
Early proposals required that the value of argc  passed  to  main()  be
"one  or greater". This was driven by the same requirement in drafts of
the ISO C standard. In fact, historical implementations have  passed  a
value  of zero when no arguments are supplied to the caller of the exec
functions.  This requirement was removed from the  ISO C  standard  and
subsequently  removed from this volume of IEEE Std 1003.1-2001 as well.
The wording, in particular the use  of  the  word  should,  requires  a
Strictly  Conforming POSIX Application to pass at least one argument to
the exec function, thus guaranteeing that argc be one or  greater  when
invoked  by  such an application. In fact, this is good practice, since
many existing applications reference argv[0] without first checking the
value of argc.

However, there's nothing disallowing argv[0] from being NULL; and in any event, there's really no reason why true ought to be poking at argv-anything.

Name: Anonymous 2009-10-31 2:58

>>17
So the solution to poor, unrobust design is a poor, unrobust "good practice"?

Name: Anonymous 2009-10-31 5:55

>>17
i just checked the source for true (on Linux, Ubanto):
int main(int argc, char *argv[])
{
   if(return(0) != 0)
   {
      err(1, argv[0]);
   }
}

obviously, it encountered an error while returning 0 and segfaulted when it tried to report said error.

Name: Anonymous 2009-10-31 6:10


/* @true.c */
int main() {
 return 0;
}

Name: Haxus the True 2009-10-31 6:37

/*
    True
    Copyright (C)

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/

/* Main include header for the True library */

#ifndef _TRUE_H
#define _TRUE_H

int true(void) { return 1; }

#endif


Be sure to link against libtrue.a

Name: Anonymous 2009-10-31 6:57

>>20
Anonix Quality.

Name: Anonymous 2009-10-31 8:27

return 1

Name: Anonymous 2009-10-31 8:41

>>21
GNU quality.

Name: Anonymous 2009-10-31 13:26

>>24
That implementation lacks the GNU standard --help and --version options, and also is not internationalized properly.
Sorry, can't accept into mainline until you fix these egregious errors.

Name: Anonymous 2009-10-31 16:01

tolva:~ snorri$ cat truetest.c
#include <unistd.h>
int main(int argc, char *argv[])
{
  return execl("/bin/true", NULL);
}
tolva:~ snorri$ ./a.out
tolva:~ snorri$ grep ' 22$' /usr/include/errno.h
tolva:~ snorri$ uname -a
Darwin tolva 10.0.0 Darwin Kernel Version 10.0.0: Fri Jul 31 22:47:34 PDT 2009; root:xnu-1456.1.25~1/RELEASE_I386 i386
tolva:~ snorri$

Name: Anonymous 2009-10-31 16:12

>>26
errno.h: #include <bits/errno.h>

Name: Anonymous 2009-10-31 16:15

% cat | gcc -x c -
#include <unistd.h>
int main(int argc, char *argv[])
{
  return execl("/bin/true", NULL);
}
^D
% ./a.out
zsh: segmentation fault  ./a.out
% dmesg | tail -n1
true[5656]: segfault at 0 ip 00007ffff7b07d8a sp 00007fffffffe598 error 4 in libc-2.10.1.so[7ffff7a8e000+14a000]
% sudo make me a sandwich
placing order for "a sandwich"... done
%

Name: Anonymous 2009-10-31 16:34

% sudo make me a sandwich
This is not Ubuntu, faggot

Name: Anonymous 2009-10-31 17:21

>>28
cat |
why you do this ;_;

Name: Anonymous 2009-10-31 17:28

>>30
| HOW U DO THAT | ???????????? | ??????????????

| | | | | HOW IT HILITE!!!?! | | | | |

Name: Anonymous 2009-10-31 18:32

Please refrain from posting non-programming related material.

Thank you.

Name: Anonymous 2009-10-31 18:41

>>32
Please refrain from posting non-programming related material.

Thank you.

Name: Anonymous 2010-11-15 14:17

Name: 2013-01-25 18:18

▔攗㘆鐴䡓暈䘳Ո卩䅣獅坂㙈㎐䆙⍂萄唶በ褐fだ面≃䚘杳ɠ覄肂璘ㄗ⍅Ȑ䠁㒉❒扑䠦ʄ偣✖ः陑饄ťᘒ䔕炇朤蝙坩茴၆䕀艹碐㄃舐砷蔇慸傉邐萵Š鄵Ё睰ₖ蠙ធ芖陹䍵袙⢙ࡷ儕ѡ㙇硑Ш᝙須ᙙ吖昂ぢ耘㔑ᒈŰᅧኇ䅘唒鐧劒❉ࡠᜐ莓摵ᔧ条椳莖䑲邀遂᎐႐㑸⌠ঁ؀处̧㔤衶س㎓癀炕萁墄⦀へ虗⡄杢猠ℤ灡砡ᜱ聓鉖䌩顡薃㢖⍕眴Ͷ砰餃獷♈褣疑䕐㙰֒啧薙衠ᤘ牄∰聉ᄹᜰ摢ሐ愶㑥噂⌨㖐倳猗䦙眳顈䍖㝵䡸陙∆㘙бᘠ䅲鍉ࠔ┢ℹ栘䈒蕰ᥧゔ҅厓撇♈炆鄁芇䔈∵Ĵ鎅ጩ䊆蝲刓ᥡ℃碀䡃ሒ厗║戕ȥ䠔儘疙匰ℕ焕㉴爙䦓䠓蘗户̒她ᐣ荹̣㔑᝱啠畄̙合☁祰䐒脘兓㈅霧邀䞘घ挦᥁ʄ䎓限䙀錡脵焕ㆃ列祱餖㌒瘔ቔ鑀匥❇冂茱耈ԙ挒呸䝸䑧㥰ᒄ儃䒓㙡吆鄅昷
持襦噢坨鍃大ㅘ捉䕈⦒掙鐂䌨㎙聐唉b碄桥蜹➇♣⎑⦐扠礨斕ʖ馆有蕃鈉茐㈁捷攘阃銂ဥ畐鄧❀偩Ʉ酘゙餀塄甉夁萀ᕕ兰㡅葘桥䌥阨硐☥先⌂ᅗ㥔ᥓ䄤钕≃!艈皇钆塈杢⥕栄襔圈鉡❐㔥䄥㌗ࢅ㉐褗鐰㈂桰˜䖅蜧萷卢䖂ሳ⢈㚄㖑捒挈萴琡咑⠣3ᜱ邇⥔őچ䐃鈓ᔃ䁤构㌁父ប·㌇戡鍖䝙艅 襁劅酶焲ↀ獰怅陷┣怙餂杣晦䈉妓噣蕄攵ܱ恠㘘阶邖葶ᢅᙨ⡆ᐄↇ牤〣Ũ憔㢁ɹ噤⒐ѧ鄗∦₀㔁ၦ㚈䐷ᜨᄩ挵✗␙ᄱ࢙礧䘓ْ䤙䅨ቖᅓ⌦㙠⑴㤧鍓隐倗襴ₒㅧ≨茘瀓ᄰ猱⑔թ牅ٴ禒坦░ᡙ慘晀璔鄡⁢

Don't change these.
Name: Email:
Entire Thread Thread List