archive_options.c (302408) | archive_options.c (311041) |
---|---|
1/*- 2 * Copyright (c) 2011 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 --- 12 unchanged lines hidden (view full) --- 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$"); 28 | 1/*- 2 * Copyright (c) 2011 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 --- 12 unchanged lines hidden (view full) --- 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$"); 28 |
29#ifdef HAVE_ERRNO_H 30#include <errno.h> 31#endif 32 |
|
29#include "archive_options_private.h" 30 31static const char * 32parse_option(const char **str, 33 const char **mod, const char **opt, const char **val); 34 35int 36_archive_set_option(struct archive *a, --- 63 unchanged lines hidden (view full) --- 100 char *data; 101 const char *s, *mod, *opt, *val; 102 103 archive_check_magic(a, magic, ARCHIVE_STATE_NEW, fn); 104 105 if (options == NULL || options[0] == '\0') 106 return ARCHIVE_OK; 107 | 33#include "archive_options_private.h" 34 35static const char * 36parse_option(const char **str, 37 const char **mod, const char **opt, const char **val); 38 39int 40_archive_set_option(struct archive *a, --- 63 unchanged lines hidden (view full) --- 104 char *data; 105 const char *s, *mod, *opt, *val; 106 107 archive_check_magic(a, magic, ARCHIVE_STATE_NEW, fn); 108 109 if (options == NULL || options[0] == '\0') 110 return ARCHIVE_OK; 111 |
108 data = (char *)malloc(strlen(options) + 1); 109 strcpy(data, options); | 112 if ((data = strdup(options)) == NULL) { 113 archive_set_error(a, 114 ENOMEM, "Out of memory adding file to list"); 115 return (ARCHIVE_FATAL); 116 } |
110 s = (const char *)data; 111 112 do { 113 mod = opt = val = NULL; 114 115 parse_option(&s, &mod, &opt, &val); 116 if (mod == NULL && opt != NULL && 117 strcmp("__ignore_wrong_module_name__", opt) == 0) { --- 94 unchanged lines hidden --- | 117 s = (const char *)data; 118 119 do { 120 mod = opt = val = NULL; 121 122 parse_option(&s, &mod, &opt, &val); 123 if (mod == NULL && opt != NULL && 124 strcmp("__ignore_wrong_module_name__", opt) == 0) { --- 94 unchanged lines hidden --- |