linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* getutline (3) fails on a daemon process
@ 2007-06-12 15:01 vadiraj
  2007-06-12 15:19 ` Glynn Clements
  0 siblings, 1 reply; 2+ messages in thread
From: vadiraj @ 2007-06-12 15:01 UTC (permalink / raw)
  To: linux-c-programming

Hi List,

I'm trying to fetch userid using utmp.h API's. I'm able to get the
userid from the funciton getutline(3) on normal process. But the
same function while called by a daemon process it fails with perror
"no such process".

Any Idea why this is failing on a daemon process? 

here is the sudo code of the program I'm using.


    struct utmp *out_entry ;
    out_entry = calloc(1,sizeof(struct utmp));
    if(out_entry == NULL)
        return -1;

    strcpy (out_entry->ut_line,"pts/0") ;
    out_entry = getutline(out_entry) ;
    if(out_entry != NULL){
        strcpy(username,out_entry->ut_user) ;
        return 0;
    }
    

I have no alternate to get the username, other calls are of no fruit to
me. Only this call is of use to me and it does work on a normal process.
It fails only if the same code is run as a daemon process.


Thanks in advance


Regards,
Vadiraj





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-12 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-12 15:01 getutline (3) fails on a daemon process vadiraj
2007-06-12 15:19 ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).