xbps_fetch_file: remove local file if bigger than remote and refetch.
This commit is contained in:
parent
74ce033d45
commit
5847a11570
@ -233,11 +233,13 @@ xbps_fetch_file(const char *uri,
|
|||||||
rv = -1;
|
rv = -1;
|
||||||
goto out;
|
goto out;
|
||||||
} else if (st.st_size > url_st.size) {
|
} else if (st.st_size > url_st.size) {
|
||||||
xbps_error_printf("Local file %s is greater than remote "
|
/*
|
||||||
"file!\n", filename);
|
* Remove local file if bigger than remote, and refetch the
|
||||||
errno = EFBIG;
|
* whole shit again.
|
||||||
rv = -1;
|
*/
|
||||||
goto out;
|
xbps_warn_printf("Local file %s is greater than remote, "
|
||||||
|
"removing local file and refetching...\n", filename);
|
||||||
|
(void)remove(destfile);
|
||||||
} else if (restart && url_st.mtime && url_st.size &&
|
} else if (restart && url_st.mtime && url_st.size &&
|
||||||
url_st.size == st.st_size && url_st.mtime == st.st_mtime) {
|
url_st.size == st.st_size && url_st.mtime == st.st_mtime) {
|
||||||
/* Local and remote size/mtime match, do nothing. */
|
/* Local and remote size/mtime match, do nothing. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user