Commit 1c4dbff8 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Figure out if we need O_LARGEFILE to be compatible with 1990 or later

size disks.

Submitted by:	wichert

Fixes ticket 283



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3021 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 926479e6
......@@ -194,7 +194,7 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile)
" to %ju due to system limitations\n", l);
if (l < st.st_size) {
AZ(ftruncate(sc->fd, l));
AZ(ftruncate(sc->fd, (off_t)l));
} else if (l - st.st_size > fssize) {
l = fssize * 80 / 100;
fprintf(stderr, "WARNING: storage file size reduced"
......@@ -228,7 +228,7 @@ smf_initfile(struct smf_sc *sc, const char *size, int newfile)
{
smf_calcsize(sc, size, newfile);
AZ(ftruncate(sc->fd, sc->filesize));
AZ(ftruncate(sc->fd, (off_t)sc->filesize));
/* XXX: force block allocation here or in open ? */
}
......@@ -279,7 +279,11 @@ smf_init(struct stevedore *parent, int ac, char * const *av)
parent->priv = sc;
/* try to create a new file of this name */
#ifdef O_LARGEFILE
sc->fd = open(fn, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0600);
#else
sc->fd = open(fn, O_RDWR | O_CREAT | O_EXCL, 0600);
#endif
if (sc->fd >= 0) {
sc->filename = fn;
mgt_child_inherit(sc->fd, "storage_file");
......
......@@ -259,6 +259,9 @@ open_log(const char *w_arg, int a_flag)
int fd, flags;
flags = (a_flag ? O_APPEND : O_TRUNC) | O_WRONLY | O_CREAT;
#ifdef O_LARGEFILE
flags |= O_LARGEFILE;
#endif
if (!strcmp(w_arg, "-"))
fd = STDOUT_FILENO;
else
......
......@@ -142,6 +142,7 @@ AC_CHECK_FUNCS([strlcat strlcpy])
AC_CHECK_FUNCS([strndup])
AC_CHECK_FUNCS([vis strvis strvisx])
AC_CHECK_FUNCS([daemon])
AC_SYS_LARGEFILE
save_LIBS="${LIBS}"
LIBS="${LIBS} ${RT_LIBS}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment