1
/* This file is part of Strigi Desktop Search
3
* Copyright (C) 2007 Jos van den Oever <jos@vandenoever.info>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public License
16
* along with this library; see the file COPYING.LIB. If not, write to
17
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
29
* Test to check if the file size returned from stat() can handle large files
32
stat64bitTest(int argc, char* argv[]) {
34
if (sizeof(off_t) < 8) return 1;
36
// create a file of 5 GB
37
FILE* file = tmpfile();
38
if (file == 0) return 1;
39
off_t size = 5368709120ll;
40
if (fseeko(file, size, SEEK_SET)) return 1;
41
if (fwrite("hi", 1, 2, file) != 2) return 1;
42
if (fflush(file)) return 1;
45
int fd = fileno(file);
46
if (fd == -1) return 1;
48
if (fstat(fd, &s)) return 1;
49
if (s.st_size != 5368709122ll) return 1;
50
if (fclose(file)) return 1;