From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,83d3dd560ad63c4e X-Google-Attributes: gidfee84,public From: Dan.Pop@mail.cern.ch (Dan Pop) Subject: Re: compilation under OSF1 Date: 1995/07/27 Message-ID: #1/1 X-Deja-AN: 107033217 sender: news@news.cern.ch (USENET News System) x-nntp-posting-host: ues5.cern.ch references: <3v4ki1$h6v@lantana.singnet.com.sg> organization: CERN European Lab for Particle Physics newsgroups: comp.unix.osf.osf1 In <3v4ki1$h6v@lantana.singnet.com.sg> koonteck@merlion.singnet.com.sg (Chua Koon Teck) writes: >I am trying to compile a very simple program under OSF1 which contains >the command getlogin_r(char*, int). My program is : > >include >#include >#include >#include > >int main(void) >{ > int fd; > char* login; > int len; > int status; > > status = getlogin_r(login, len); ^^^^^ ^^^ Neither login nor len are initialized. getlogin_r will, probably, cause a segmentation fault. > > printf("status: %d, login: %s\n", len, login); >} > >I uses "cc -o pinewrap pinewrap.c". But it seems that the linker could >not resolve the getlogin_r command. The man page isn't as helpful as it should have been, because it doesn't tell you to put -lc_r at the end of your cc line if you want to use getlogin_r. But fix your code first. Dan -- Dan Pop CERN, CN Division Email: Dan.Pop@mail.cern.ch Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland