summaryrefslogtreecommitdiff
path: root/librazor
diff options
context:
space:
mode:
authorJames Bowes <jbowes@redhat.com>2008-06-26 17:16:13 -0400
committerJames Bowes <jbowes@redhat.com>2008-06-26 17:16:13 -0400
commitc57370decf4e204cf4e3323e669cc676a2760707 (patch)
tree6272c18f292a42f18223c71dd201caa497b4b098 /librazor
parent436386fb11ee56e50c2c76c496b1f6c39530e170 (diff)
Add return codes to razor_set_open_files and open_details
Diffstat (limited to 'librazor')
-rw-r--r--librazor/razor.c16
-rw-r--r--librazor/razor.h4
2 files changed, 12 insertions, 8 deletions
diff --git a/librazor/razor.c b/librazor/razor.c
index 3bfee2f..b1d7a20 100644
--- a/librazor/razor.c
+++ b/librazor/razor.c
@@ -119,7 +119,7 @@ razor_set_open(const char *filename)
return set;
}
-RAZOR_EXPORT void
+RAZOR_EXPORT int
razor_set_open_details(struct razor_set *set, const char *filename)
{
struct razor_set_section *s;
@@ -129,10 +129,10 @@ razor_set_open_details(struct razor_set *set, const char *filename)
fd = open(filename, O_RDONLY);
if (fstat(fd, &stat) < 0)
- return;
+ return -1;
set->details_header = mmap(NULL, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (set->details_header == MAP_FAILED)
- return;
+ return -1;
for (s = set->details_header->sections; ~s->type; s++) {
if (s->type >= ARRAY_SIZE(razor_details_sections))
@@ -145,9 +145,11 @@ razor_set_open_details(struct razor_set *set, const char *filename)
array->alloc = s->size;
}
close(fd);
+
+ return 0;
}
-RAZOR_EXPORT void
+RAZOR_EXPORT int
razor_set_open_files(struct razor_set *set, const char *filename)
{
struct razor_set_section *s;
@@ -157,10 +159,10 @@ razor_set_open_files(struct razor_set *set, const char *filename)
fd = open(filename, O_RDONLY);
if (fstat(fd, &stat) < 0)
- return;
+ return -1;
set->files_header = mmap(NULL, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (set->files_header == MAP_FAILED)
- return;
+ return -1;
for (s = set->files_header->sections; ~s->type; s++) {
if (s->type >= ARRAY_SIZE(razor_files_sections))
@@ -173,6 +175,8 @@ razor_set_open_files(struct razor_set *set, const char *filename)
array->alloc = s->size;
}
close(fd);
+
+ return 0;
}
RAZOR_EXPORT void
diff --git a/librazor/razor.h b/librazor/razor.h
index e5567f2..61edc1c 100644
--- a/librazor/razor.h
+++ b/librazor/razor.h
@@ -77,8 +77,8 @@ int razor_set_write_to_fd(struct razor_set *set, int fd,
int razor_set_write(struct razor_set *set, const char *filename,
enum razor_repo_file_type type);
-void razor_set_open_details(struct razor_set *set, const char *filename);
-void razor_set_open_files(struct razor_set *set, const char *filename);
+int razor_set_open_details(struct razor_set *set, const char *filename);
+int razor_set_open_files(struct razor_set *set, const char *filename);
struct razor_package *
razor_set_get_package(struct razor_set *set, const char *package);