Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Dan.Pop@mail.cern.ch (Dan Pop)
Subject: Re: compilation under OSF1
Date: 1995/07/27	[thread overview]
Message-ID: <danpop.806843706@rscernix> (raw)
In-Reply-To: 3v4ki1$h6v@lantana.singnet.com.sg

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 <sys/types.h>
>#include <sys/stat.h>
>#include <fcntl.h>
>#include <unistd.h>
>
>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



      reply	other threads:[~1995-07-27  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-07-26  4:00 compilation under OSF1 Chua Koon Teck
1995-07-27  4:00 ` Dan Pop [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox