Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
modules/test: always return -errno on open() errors
Browse files Browse the repository at this point in the history
Instead of returning errno or even custom return values at
some circustances.

Signed-off-by: Bruno Dilly <bruno.dilly@intel.com>
  • Loading branch information
bdilly committed Sep 29, 2015
1 parent dee53d8 commit e242646
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/modules/flow/test/boolean-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ boolean_generator_open(

if (opts->sequence == NULL || *opts->sequence == '\0') {
SOL_ERR("Option 'sequence' is either NULL or empty.");
return -1;
return -EINVAL;
}

mdata->it = mdata->sequence = strdup(opts->sequence);
Expand Down
6 changes: 3 additions & 3 deletions src/modules/flow/test/float-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ float_generator_open(
}
if (it == tail) {
SOL_WRN("Failed to convert option 'sequence' to int %s", it);
errno = -EINVAL;
errno = EINVAL;
goto error;
}
it = tail;
Expand All @@ -107,10 +107,10 @@ float_generator_open(
return 0;

no_memory:
errno = -ENOMEM;
errno = ENOMEM;
error:
sol_vector_clear(&mdata->values);
return errno;
return -errno;
}

void
Expand Down
6 changes: 3 additions & 3 deletions src/modules/flow/test/float-validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ float_validator_open(
}
if (it == tail) {
SOL_WRN("Failed to convert option 'sequence' to double %s", it);
errno = -EINVAL;
errno = EINVAL;
goto error;
}
it = tail;
Expand All @@ -84,10 +84,10 @@ float_validator_open(
return 0;

no_memory:
errno = -ENOMEM;
errno = ENOMEM;
error:
sol_vector_clear(&mdata->values);
return errno;
return -errno;
}

int
Expand Down
6 changes: 3 additions & 3 deletions src/modules/flow/test/int-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int_generator_open(
}
if (it == tail) {
SOL_WRN("Failed to convert option 'sequence' to int %s", it);
errno = -EINVAL;
errno = EINVAL;
goto error;
}
it = tail;
Expand All @@ -110,10 +110,10 @@ int_generator_open(
return 0;

no_memory:
errno = -ENOMEM;
errno = ENOMEM;
error:
sol_vector_clear(&mdata->values);
return errno;
return -errno;
}

void
Expand Down

0 comments on commit e242646

Please sign in to comment.