/*
 * linkat: hard link
 */

#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc, char **argv)
{
	(void)argc;
	char a[256], b[260];
	snprintf(a, sizeof a, "%s/t057_XXXXXX", argv[1]);
	int fd = mkstemp(a);
	if (fd >= 0) {
		close(fd);
		snprintf(b, sizeof b, "%s.lnk", a);
		linkat(AT_FDCWD, a, AT_FDCWD, b, 0);
		unlink(b);
		unlink(a);
	}
	return 0;
}
