Back to index

glibc  2.9
cuserid.c File Reference
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>

Go to the source code of this file.


char * cuserid (char *s)

Function Documentation

char* cuserid ( char *  s)

Definition at line 29 of file cuserid.c.

  static char name[L_cuserid];
  char buf[NSS_BUFLEN_PASSWD];
  struct passwd pwent;
  struct passwd *pwptr;

  if (__getpwuid_r (__geteuid (), &pwent, buf, sizeof (buf), &pwptr)
      || pwptr == NULL)
      if (s != NULL)
       s[0] = '\0';
      return s;

  if (s == NULL)
    s = name;
  return strncpy (s, pwptr->pw_name, L_cuserid);

Here is the call graph for this function: