On 06/01/2011 09:14 AM, Jan Friesse wrote: > Signed-off-by: Jan Friesse <jfrie...@redhat.com> > --- > lib/coroipcc.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/lib/coroipcc.c b/lib/coroipcc.c > index 1adce0e..862047d 100644 > --- a/lib/coroipcc.c > +++ b/lib/coroipcc.c > @@ -311,6 +311,10 @@ circular_memory_map (char *path, const char *file, void > **buf, size_t bytes) > } > > page_size = sysconf(_SC_PAGESIZE); > + if (page_size < 0) { > + goto error_close_unlink; > + } > + > buffer = malloc (page_size); > if (buffer == NULL) { > goto error_close_unlink; > @@ -417,6 +421,10 @@ memory_map (char *path, const char *file, void **buf, > size_t bytes) > goto error_close_unlink; > } > page_size = sysconf(_SC_PAGESIZE); > + if (page_size < 0) { > + goto error_close_unlink; > + } > + > buffer = malloc (page_size); > if (buffer == NULL) { > goto error_close_unlink;
Prefer a direct comparison for the error condition ie: if (page_size == -1) { } RETURN VALUE If name is invalid, -1 is returned, and errno is set to EINVAL. Other‐ wise, the value returned is the value of the system resource and errno is not changed. In the case of options, a positive value is returned if a queried option is available, and -1 if it is not. In the case of limits, -1 means that there is no definite limit. _______________________________________________ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais