2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-23 10:01:46 +00:00
xcat-dep/cpio/cpio-2.10-patternnamesigsegv.patch
xq2005 c17860af8c add cpio-2.11 into the xCAT dependecy
Former-commit-id: bd30424ca9b2f1bc3a4650e5875a9dea44da664d
2013-05-28 07:53:32 +00:00

42 lines
1.4 KiB
Diff

diff -urNp cpio-2.10-orig/src/copyin.c cpio-2.10/src/copyin.c
--- cpio-2.10-orig/src/copyin.c 2010-02-22 12:57:59.000000000 +0100
+++ cpio-2.10/src/copyin.c 2010-02-22 12:55:26.000000000 +0100
@@ -944,20 +944,23 @@ read_pattern_file ()
pattern_fp = fopen (pattern_file_name, "r");
if (pattern_fp == NULL)
open_error (pattern_file_name);
- while (ds_fgetstr (pattern_fp, &pattern_name, '\n') != NULL)
- {
- if (new_num_patterns >= max_new_patterns)
- {
- max_new_patterns += 1;
- new_save_patterns = (char **)
- xrealloc ((char *) new_save_patterns,
- max_new_patterns * sizeof (char *));
- }
- new_save_patterns[new_num_patterns] = xstrdup (pattern_name.ds_string);
- ++new_num_patterns;
- }
- if (ferror (pattern_fp) || fclose (pattern_fp) == EOF)
- close_error (pattern_file_name);
+ else
+ {
+ while (ds_fgetstr (pattern_fp, &pattern_name, '\n') != NULL)
+ {
+ if (new_num_patterns >= max_new_patterns)
+ {
+ max_new_patterns += 1;
+ new_save_patterns = (char **)
+ xrealloc ((char *) new_save_patterns,
+ max_new_patterns * sizeof (char *));
+ }
+ new_save_patterns[new_num_patterns] = xstrdup (pattern_name.ds_string);
+ ++new_num_patterns;
+ }
+ if (ferror (pattern_fp) || fclose (pattern_fp) == EOF)
+ close_error (pattern_file_name);
+ }
for (i = 0; i < num_patterns; ++i)
new_save_patterns[i] = save_patterns[i];