Don't rely on Posix links in kadmin/stash.c

This commit is contained in:
Asanka Herath
2009-09-14 13:38:14 -04:00
committed by Love Hornquist Astrand
parent b79445f4e4
commit 14ae739820

View File

@@ -128,12 +128,18 @@ stash(struct stash_options *opt, int argc, char **argv)
unlink(new);
else {
unlink(old);
#ifndef NO_POSIX_LINKS
if(link(opt->key_file_string, old) < 0 && errno != ENOENT) {
ret = errno;
unlink(new);
} else if(rename(new, opt->key_file_string) < 0) {
} else {
#endif
if(rename(new, opt->key_file_string) < 0) {
ret = errno;
}
#ifndef NO_POSIX_LINKS
}
#endif
}
out:
free(old);