Deleted Added
full compact
fifolog_create.c (176998) fifolog_create.c (219027)
1/*-
2 * Copyright (c) 2005-2008 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2005-2008 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/fifolog/lib/fifolog_create.c 176998 2008-03-09 19:14:36Z phk $
26 * $FreeBSD: head/usr.sbin/fifolog/lib/fifolog_create.c 219027 2011-02-25 09:40:17Z phk $
27 */
28
29#include <assert.h>
30#include <errno.h>
31#include <stdio.h>
32#include <string.h>
33#include <unistd.h>
34#include <fcntl.h>

--- 51 unchanged lines hidden (view full) ---

86 /* If no configured size, or too large for disk, use device size */
87 i = ioctl(fd, DIOCGMEDIASIZE, &ms);
88 if (i == 0 && (size == 0 || size > ms))
89 size = ms;
90
91 if (size == 0 && S_ISREG(st.st_mode))
92 size = st.st_size;
93
27 */
28
29#include <assert.h>
30#include <errno.h>
31#include <stdio.h>
32#include <string.h>
33#include <unistd.h>
34#include <fcntl.h>

--- 51 unchanged lines hidden (view full) ---

86 /* If no configured size, or too large for disk, use device size */
87 i = ioctl(fd, DIOCGMEDIASIZE, &ms);
88 if (i == 0 && (size == 0 || size > ms))
89 size = ms;
90
91 if (size == 0 && S_ISREG(st.st_mode))
92 size = st.st_size;
93
94 if (size == 0)
94 if (size == 0)
95 size = recsize * (off_t)(24*60*60);
96
97 if (S_ISREG(st.st_mode) && ftruncate(fd, size) < 0)
98 return ("Could not ftrunc");
99
100 buf = calloc(recsize, 1);
101 if (buf == NULL)
102 return ("Could not malloc");

--- 20 unchanged lines hidden ---
95 size = recsize * (off_t)(24*60*60);
96
97 if (S_ISREG(st.st_mode) && ftruncate(fd, size) < 0)
98 return ("Could not ftrunc");
99
100 buf = calloc(recsize, 1);
101 if (buf == NULL)
102 return ("Could not malloc");

--- 20 unchanged lines hidden ---