mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-24 16:14:59 +08:00
write check wrong, write returns number of bytes written, hence always larger than 0. Thanks to @mwalker33 for the fix
This commit is contained in:
parent
5effb4f886
commit
791d9e09ac
1 changed files with 2 additions and 5 deletions
|
@ -430,7 +430,7 @@ static void *sorttable(void *dd) {
|
|||
printf("cannot create outfile %s\n", outfile);
|
||||
exit(1);
|
||||
}
|
||||
if (write(fdout, table, numentries * DATASIZE)) {
|
||||
if (write(fdout, table, numentries * DATASIZE) != (numentries * DATASIZE)) {
|
||||
printf("writetable cannot write all of the data\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ int main(int argc, char *argv[]) {
|
|||
// make the table of tables
|
||||
t = (struct table *)calloc(sizeof(struct table) * 65536, sizeof(uint8_t));
|
||||
if (!t) {
|
||||
printf("malloc failed\n");
|
||||
printf("calloc failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -503,11 +503,8 @@ int main(int argc, char *argv[]) {
|
|||
free_tables(t);
|
||||
free(t);
|
||||
|
||||
|
||||
|
||||
// now for the sorting
|
||||
|
||||
|
||||
// start the threads
|
||||
for (long i = 0; i < NUM_SORT_THREADS; i++) {
|
||||
int ret = pthread_create(&(threads[i]), NULL, sorttable, (void *)(i));
|
||||
|
|
Loading…
Reference in a new issue