ssize_t readlink_as_user(const char *fname, char *buf, size_t sz) {
	assert(fname && buf && sz);

	int called_as_root = 0;
	if (geteuid() == 0)
		called_as_root = 1;

	if (called_as_root)
		EUID_USER();

	ssize_t rv = readlink(fname, buf, sz);

	if (called_as_root)
		EUID_ROOT();

	return rv;
}
ssize_t readlink_as_user(const char *fname, char *buf, size_t sz) {
	assert(fname && buf && sz);

	int called_as_root = 0;
	if (geteuid() == 0)
		called_as_root = 1;

	if (called_as_root)
		EUID_USER();

	ssize_t rv = readlink(fname, buf, sz);

	if (called_as_root)
		EUID_ROOT();

	return rv;
}