diff options
author | Kota Tsuyuzaki <bloodeagle40234@gmail.com> | 2015-02-01 23:04:25 -0800 |
---|---|---|
committer | Kota Tsuyuzaki <bloodeagle40234@gmail.com> | 2015-02-27 15:24:04 +0900 |
commit | aa0c9605048153f640b8b871da9e483347e4b70f (patch) | |
tree | f880589dc2eaa73cbc215ae9b06f15891787eacc /src | |
parent | 289099c43d63f049c75c2e9bfd49eaa545a12847 (diff) | |
download | liberasurecode-aa0c9605048153f640b8b871da9e483347e4b70f.tar.gz |
Fix get_fragment_partition return value
When num_missing is over than the num of parities (i.e. > m),
get_fragment_partition should return -1 as an error code.
This patch fixes it and adds a test called "test_get_fragment_partition"
into liberasurecode_test.c.
Diffstat (limited to 'src')
-rw-r--r-- | src/erasurecode_preprocessing.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/erasurecode_preprocessing.c b/src/erasurecode_preprocessing.c index 62134ba..b55f635 100644 --- a/src/erasurecode_preprocessing.c +++ b/src/erasurecode_preprocessing.c @@ -245,8 +245,9 @@ int get_fragment_partition( num_missing++; } } - - return (num_missing > m) ? 1 : 0; + // TODO: In general, it is possible to reconstruct one or more fragments + // when more than m fragments are missing (e.g. flat XOR codes) + return (num_missing > m) ? -1 : 0; } int fragments_to_string(int k, int m, |