user1011471
user1011471

Reputation: 1130

realpath() in my env doesn't like NULL as second argument?

I'm on a linux box and /proc/self/exe does seem to be supported:

But:

if (NULL == realpath("/proc/self/exe", NULL))
{
  printf("this prints unexpectedly, %s\n", strerror(errno));
}

At this point, errno is 22 and I see Invalid argument. Why? Or -- how does one figure out why?

Upvotes: 2

Views: 500

Answers (1)

Eugene Sh.
Eugene Sh.

Reputation: 18311

This behavior would occur on glibc versions below 2.3 as stated in man realpath:

ERRORS
............
EINVAL - path is NULL. (In glibc versions before 2.3, this error is also returned if resolved_path is NULL.)

Upvotes: 4

Related Questions