/* Copyright (c) 2006-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream.h"
#include "ostream.h"
#include "file-copy.h"
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
bool try_hardlink)
{
if (try_hardlink) {
/* see if hardlinking works */
return 1;
if (i_unlink_if_exists(tmppath) < 0)
return -1;
return 1;
}
return 0;
return -1;
}
/* fallback to manual copying */
}
if (fd_in == -1) {
return 0;
return -1;
}
i_close_fd(&fd_in);
return -1;
}
if (fd_out == -1) {
i_close_fd(&fd_in);
return -1;
}
/* try to change the group, don't really care if it fails */
ret = 0;
break;
i_unreached();
break;
break;
}
ret = -1;
}
ret = -1;
}
}
{
int ret;
T_BEGIN {
const char *tmppath;
if (ret > 0) {
i_error("rename(%s, %s) failed: %m",
ret = -1;
}
}
if (ret < 0)
} T_END;
return ret;
}