| @@ -1,23 +1,23 @@ | | | @@ -1,23 +1,23 @@ |
1 | /* $NetBSD: build.c,v 1.9 2009/02/02 12:35:01 joerg Exp $ */ | | 1 | /* $NetBSD: build.c,v 1.10 2009/02/05 16:06:55 joerg Exp $ */ |
2 | | | 2 | |
3 | #if HAVE_CONFIG_H | | 3 | #if HAVE_CONFIG_H |
4 | #include "config.h" | | 4 | #include "config.h" |
5 | #endif | | 5 | #endif |
6 | #include <nbcompat.h> | | 6 | #include <nbcompat.h> |
7 | #if HAVE_SYS_CDEFS_H | | 7 | #if HAVE_SYS_CDEFS_H |
8 | #include <sys/cdefs.h> | | 8 | #include <sys/cdefs.h> |
9 | #endif | | 9 | #endif |
10 | __RCSID("$NetBSD: build.c,v 1.9 2009/02/02 12:35:01 joerg Exp $"); | | 10 | __RCSID("$NetBSD: build.c,v 1.10 2009/02/05 16:06:55 joerg Exp $"); |
11 | | | 11 | |
12 | /*- | | 12 | /*- |
13 | * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. | | 13 | * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. |
14 | * All rights reserved. | | 14 | * All rights reserved. |
15 | * | | 15 | * |
16 | * This code was developed as part of Google's Summer of Code 2007 program. | | 16 | * This code was developed as part of Google's Summer of Code 2007 program. |
17 | * | | 17 | * |
18 | * Redistribution and use in source and binary forms, with or without | | 18 | * Redistribution and use in source and binary forms, with or without |
19 | * modification, are permitted provided that the following conditions | | 19 | * modification, are permitted provided that the following conditions |
20 | * are met: | | 20 | * are met: |
21 | * | | 21 | * |
22 | * 1. Redistributions of source code must retain the above copyright | | 22 | * 1. Redistributions of source code must retain the above copyright |
23 | * notice, this list of conditions and the following disclaimer. | | 23 | * notice, this list of conditions and the following disclaimer. |
| @@ -310,27 +310,26 @@ make_dist(const char *pkg, const char *s | | | @@ -310,27 +310,26 @@ make_dist(const char *pkg, const char *s |
310 | archive_entry_linkify(resolver, &entry, &sparse_entry); | | 310 | archive_entry_linkify(resolver, &entry, &sparse_entry); |
311 | while (entry != NULL) { | | 311 | while (entry != NULL) { |
312 | write_entry(archive, entry); | | 312 | write_entry(archive, entry); |
313 | entry = NULL; | | 313 | entry = NULL; |
314 | archive_entry_linkify(resolver, &entry, &sparse_entry); | | 314 | archive_entry_linkify(resolver, &entry, &sparse_entry); |
315 | } | | 315 | } |
316 | | | 316 | |
317 | archive_entry_linkresolver_free(resolver); | | 317 | archive_entry_linkresolver_free(resolver); |
318 | | | 318 | |
319 | if (archive_write_close(archive)) | | 319 | if (archive_write_close(archive)) |
320 | errx(2, "cannot finish archive: %s", archive_error_string(archive)); | | 320 | errx(2, "cannot finish archive: %s", archive_error_string(archive)); |
321 | archive_write_finish(archive); | | 321 | archive_write_finish(archive); |
322 | | | 322 | |
323 | chdir(initial_cwd); | | | |
324 | free(initial_cwd); | | 323 | free(initial_cwd); |
325 | } | | 324 | } |
326 | | | 325 | |
327 | static struct memory_file * | | 326 | static struct memory_file * |
328 | load_and_add(package_t *plist, const char *input_name, | | 327 | load_and_add(package_t *plist, const char *input_name, |
329 | const char *target_name, mode_t perm) | | 328 | const char *target_name, mode_t perm) |
330 | { | | 329 | { |
331 | struct memory_file *file; | | 330 | struct memory_file *file; |
332 | | | 331 | |
333 | file = load_memory_file(input_name, target_name, DefaultOwner, | | 332 | file = load_memory_file(input_name, target_name, DefaultOwner, |
334 | DefaultGroup, perm); | | 333 | DefaultGroup, perm); |
335 | add_plist(plist, PLIST_IGNORE, NULL); | | 334 | add_plist(plist, PLIST_IGNORE, NULL); |
336 | add_plist(plist, PLIST_FILE, target_name); | | 335 | add_plist(plist, PLIST_FILE, target_name); |