Re: getpwuid returning null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 21, 2008 at 7:53 PM, tomy <tomy@xxxxxxxxxxxx> wrote:
> hi,
>  While printing the error it displaying  " No such file or directory".
>  What is the default file for getpwuid?...
>

The man page says this :

NOTE
       The user password database mostly refers to /etc/passwd.
However, with recent systems it also refers to network wide databases
       using NIS, LDAP and other local files as configured in
/etc/nsswitch.conf.

FILES
       /etc/passwd
              local password database file

       /etc/nsswitch.conf
              System Databases and Name Service Switch configuration file


Thanks


>
>
> Martin Mancuska wrote:
>  > Did you try to print errno value ?
>  >
>  > martin
>  >
>  > 2008/2/21, tomy <tomy@xxxxxxxxxxxx>:
>  >
>  >> In my application
>  >>
>  >>  #include <unistd.h>
>  >>  #include <sys/types.h>
>  >>  #include <stdio.h>
>  >>  int main()
>  >>  {
>  >>     uid_t uid;
>  >>     struct passwd *pw=NULL;
>  >>     uid=getuid();
>  >>     pw=(struct passwd *)getpwuid(uid);
>  >>     printf("uid is %d\n",uid);
>  >>     printf("Password structure addr is %d",pw);
>  >>  }
>  >>
>  >>  Output is
>  >>  uid is 0
>  >>  Password structure addr is 0
>  >>  Why this is happening?.....
>  >>
>  >>  --
>  >>  Thanks & Regards
>  >>
>  >>  Tomy Devasia
>  >>  Product Devpt & Support
>  >>  Kalki Communication Technologies Ltd
>  >>  Bangalore
>  >>  India
>  >>
>  >>
>  >>
>  >>  --
>  >>  To unsubscribe from this list: send an email with
>  >>  "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>  >>  Please read the FAQ at http://kernelnewbies.org/FAQ
>  >>
>  >>
>  >>
>  >
>  >
>  >
>
>
>  --
>  Thanks & Regards
>
>  Tomy Devasia
>  Product Devpt & Support
>  Kalki Communication Technologies Ltd
>  Bangalore
>  India
>
>
>  --
>  To unsubscribe from this list: send an email with
>  "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>  Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Thanks & Regards,
********************************************
Manish Katiyar ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux