shithub: npe

ref: 237831f5ec11e7bb6da2961c1e5f5bc0c3610347
dir: /libnpe/fstatat.c/

View raw version
#include <unistd.h>
#include <errno.h>

#undef stat

int
fstatat(int dirfd, char *path, struct npe_stat *buf, int flags)
{
	char *s, p[8192];
	int r;

	USED(flags);

	if(fd2path(dirfd, p, sizeof(p)-1) != 0)
		return -1;
	if((s = smprint("%s/%s", p, path)) == nil)
		return -1;
	r = npe_stat(s, buf);
	free(s);

	return r;
}