summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_files.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-06-27 21:44:36 +1000
committerDan McGee <dan@archlinux.org>2010-07-07 07:24:57 -0500
commit60de8ec932984f1374501c3f11ad1bcfba5c7d5c (patch)
tree9b81e0d4f8fce2df996ecc5cef4010dcefa61ec3 /lib/libalpm/be_files.c
parent686b8c146398c5ba9feee2c1fa10bf9e598b2ce8 (diff)
downloadpacman-60de8ec932984f1374501c3f11ad1bcfba5c7d5c.tar.xz
Check return value of fgets calls
Prevents compiler warnings with -D_FORTIFY_SOURCE=2 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_files.c')
-rw-r--r--lib/libalpm/be_files.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 877bc505..666bb7e8 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -657,7 +657,9 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
goto error;
}
while(!feof(fp)) {
- fgets(line, 255, fp);
+ if(fgets(line, 256, fp) == NULL) {
+ break;
+ }
_alpm_strtrim(line);
if(strcmp(line, "%DEPENDS%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {
@@ -693,7 +695,9 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
snprintf(path, PATH_MAX, "%sdeltas", pkgpath);
if((fp = fopen(path, "r"))) {
while(!feof(fp)) {
- fgets(line, 255, fp);
+ if(fgets(line, 256, fp) == NULL) {
+ break;
+ }
_alpm_strtrim(line);
if(strcmp(line, "%DELTAS%") == 0) {
while(fgets(line, sline, fp) && strlen(_alpm_strtrim(line))) {