aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/sys/linux/getwd.c
blob: 72db33830ad9759df3aa6353b6f2f2c3fb441776 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <string.h>
#include <unistd.h>
#include <errno.h>

char *
getwd (char *buf)
{
  char tmp[MAXPATHLEN];

  if (buf == NULL)
    {
      errno = EINVAL;
      return NULL;
    }

  if (getcwd (tmp, MAXPATHLEN) == NULL)
    return NULL;

  return strncpy (buf, tmp, MAXPATHLEN);
}