write.c (c5c3ba6b43cac20dc9432eac15758d41cb2b8b1f) write.c (5666643a95389e3ea7637b86cc556d411242f71e)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2007 Kai Wang
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

170 * which indicates that this is to "replace a none exist member",
171 * the replace will proceed regardless of '-u'.
172 */
173 if (mtime != 0 && bsdar->options & AR_U && sb.st_mtime <= mtime)
174 goto giveup;
175
176 /*
177 * When option '-D' is specified, mtime and UID / GID from the file
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2007 Kai Wang
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

170 * which indicates that this is to "replace a none exist member",
171 * the replace will proceed regardless of '-u'.
172 */
173 if (mtime != 0 && bsdar->options & AR_U && sb.st_mtime <= mtime)
174 goto giveup;
175
176 /*
177 * When option '-D' is specified, mtime and UID / GID from the file
178 * will be replaced with 0, and file mode with 644. This ensures that
178 * will be replaced with 0, and file mode with 644. This ensures that
179 * checksums will match for two archives containing the exact same
180 * files.
181 */
182 if (bsdar->options & AR_D) {
183 obj->uid = 0;
184 obj->gid = 0;
185 obj->mtime = 0;
186 obj->md = S_IFREG | 0644;

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

640 * for other members. The size of sn table includes the pad bit.
641 */
642 if (bsdar->s_cnt != 0 && bsdar->s_sn_sz % 2 != 0)
643 bsdar->s_sn[bsdar->s_sn_sz++] = '\0';
644
645 /*
646 * Archive string table is padded by a "\n" as the normal members.
647 * The difference is that the size of archive string table counts
179 * checksums will match for two archives containing the exact same
180 * files.
181 */
182 if (bsdar->options & AR_D) {
183 obj->uid = 0;
184 obj->gid = 0;
185 obj->mtime = 0;
186 obj->md = S_IFREG | 0644;

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

640 * for other members. The size of sn table includes the pad bit.
641 */
642 if (bsdar->s_cnt != 0 && bsdar->s_sn_sz % 2 != 0)
643 bsdar->s_sn[bsdar->s_sn_sz++] = '\0';
644
645 /*
646 * Archive string table is padded by a "\n" as the normal members.
647 * The difference is that the size of archive string table counts
648 * in the pad bit, while normal members' size fileds do not.
648 * in the pad bit, while normal members' size fields do not.
649 */
650 if (bsdar->as != NULL && bsdar->as_sz % 2 != 0)
651 bsdar->as[bsdar->as_sz++] = '\n';
652
653 /*
654 * If there is a symbol table, calculate the size of pseudo members,
655 * convert previously stored relative offsets to absolute ones, and
656 * then make them Big Endian.

--- 296 unchanged lines hidden ---
649 */
650 if (bsdar->as != NULL && bsdar->as_sz % 2 != 0)
651 bsdar->as[bsdar->as_sz++] = '\n';
652
653 /*
654 * If there is a symbol table, calculate the size of pseudo members,
655 * convert previously stored relative offsets to absolute ones, and
656 * then make them Big Endian.

--- 296 unchanged lines hidden ---