Deleted Added
full compact
archive_entry_stat.c (228763) archive_entry_stat.c (232153)
1/*-
2 * Copyright (c) 2003-2007 Tim Kientzle
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

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

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "archive_platform.h"
1/*-
2 * Copyright (c) 2003-2007 Tim Kientzle
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

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

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "archive_platform.h"
27__FBSDID("$FreeBSD: head/contrib/libarchive/libarchive/archive_entry_stat.c 228763 2011-12-21 11:13:29Z mm $");
27__FBSDID("$FreeBSD: head/contrib/libarchive/libarchive/archive_entry_stat.c 232153 2012-02-25 10:58:02Z mm $");
28
29#ifdef HAVE_SYS_STAT_H
30#include <sys/stat.h>
31#endif
32#ifdef HAVE_STDLIB_H
33#include <stdlib.h>
34#endif
35
36#include "archive_entry.h"
37#include "archive_entry_private.h"
38
39const struct stat *
40archive_entry_stat(struct archive_entry *entry)
41{
42 struct stat *st;
43 if (entry->stat == NULL) {
28
29#ifdef HAVE_SYS_STAT_H
30#include <sys/stat.h>
31#endif
32#ifdef HAVE_STDLIB_H
33#include <stdlib.h>
34#endif
35
36#include "archive_entry.h"
37#include "archive_entry_private.h"
38
39const struct stat *
40archive_entry_stat(struct archive_entry *entry)
41{
42 struct stat *st;
43 if (entry->stat == NULL) {
44 entry->stat = malloc(sizeof(*st));
44 entry->stat = calloc(1, sizeof(*st));
45 if (entry->stat == NULL)
46 return (NULL);
47 entry->stat_valid = 0;
48 }
49
50 /*
51 * If none of the underlying fields have been changed, we
52 * don't need to regenerate. In theory, we could use a bitmap

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

105#endif
106#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
107 st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry);
108#endif
109
110 /*
111 * TODO: On Linux, store 32 or 64 here depending on whether
112 * the cached stat structure is a stat32 or a stat64. This
45 if (entry->stat == NULL)
46 return (NULL);
47 entry->stat_valid = 0;
48 }
49
50 /*
51 * If none of the underlying fields have been changed, we
52 * don't need to regenerate. In theory, we could use a bitmap

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

105#endif
106#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
107 st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry);
108#endif
109
110 /*
111 * TODO: On Linux, store 32 or 64 here depending on whether
112 * the cached stat structure is a stat32 or a stat64. This
113 * will allow us to support both variants interchangably.
113 * will allow us to support both variants interchangeably.
114 */
115 entry->stat_valid = 1;
116
117 return (st);
118}
114 */
115 entry->stat_valid = 1;
116
117 return (st);
118}