Deleted Added
full compact
gzip.c (1.119) gzip.c (1.120)
1/* $NetBSD: gzip.c,v 1.119 2023/06/10 04:45:25 simonb Exp $ */
1/* $NetBSD: gzip.c,v 1.120 2024/01/14 18:12:59 mrg Exp $ */
2
3/*
4 * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017
5 * Matthew R. Green
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

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

26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31#ifndef lint
32__COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\
33 2009, 2010, 2011, 2015, 2017 Matthew R. Green. All rights reserved.");
2
3/*
4 * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017
5 * Matthew R. Green
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

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

26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31#ifndef lint
32__COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\
33 2009, 2010, 2011, 2015, 2017 Matthew R. Green. All rights reserved.");
34__RCSID("$NetBSD: gzip.c,v 1.119 2023/06/10 04:45:25 simonb Exp $");
34__RCSID("$NetBSD: gzip.c,v 1.120 2024/01/14 18:12:59 mrg Exp $");
35#endif /* not lint */
36
37/*
38 * gzip.c -- GPL free gzip using zlib.
39 *
40 * RFC 1950 covers the zlib format
41 * RFC 1951 covers the deflate format
42 * RFC 1952 covers the gzip format

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

1109 sb.st_mode &= ~(S_ISUID|S_ISGID);
1110 }
1111
1112 /* we only allow set-id and the 9 normal permission bits */
1113 sb.st_mode &= S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;
1114 if (fchmod(fd, sb.st_mode) < 0)
1115 maybe_warn("couldn't fchmod: %s", file);
1116
35#endif /* not lint */
36
37/*
38 * gzip.c -- GPL free gzip using zlib.
39 *
40 * RFC 1950 covers the zlib format
41 * RFC 1951 covers the deflate format
42 * RFC 1952 covers the gzip format

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

1109 sb.st_mode &= ~(S_ISUID|S_ISGID);
1110 }
1111
1112 /* we only allow set-id and the 9 normal permission bits */
1113 sb.st_mode &= S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;
1114 if (fchmod(fd, sb.st_mode) < 0)
1115 maybe_warn("couldn't fchmod: %s", file);
1116
1117 /* only try flags if they exist already */
1118 if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0)
1119 maybe_warn("couldn't fchflags: %s", file);
1120
1121 TIMESPEC_TO_TIMEVAL(&times[0], &sb.st_atimespec);
1122 TIMESPEC_TO_TIMEVAL(&times[1], &sb.st_mtimespec);
1123 if (futimes(fd, times) < 0)
1124 maybe_warn("couldn't utimes: %s", file);
1117 TIMESPEC_TO_TIMEVAL(&times[0], &sb.st_atimespec);
1118 TIMESPEC_TO_TIMEVAL(&times[1], &sb.st_mtimespec);
1119 if (futimes(fd, times) < 0)
1120 maybe_warn("couldn't utimes: %s", file);
1121
1122 /* finally, only try flags if they exist already */
1123 if (sb.st_flags != 0 && fchflags(fd, sb.st_flags) < 0)
1124 maybe_warn("couldn't fchflags: %s", file);
1125}
1126#endif
1127
1128/* what sort of file is this? */
1129static enum filetype
1130file_gettype(u_char *buf)
1131{
1132

--- 1191 unchanged lines hidden ---
1125}
1126#endif
1127
1128/* what sort of file is this? */
1129static enum filetype
1130file_gettype(u_char *buf)
1131{
1132

--- 1191 unchanged lines hidden ---