r91546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91545‎ | r91546 | r91547 >
Date:11:04, 6 July 2011
Author:ariel
Status:deferred
Tags:
Comment:
lseek and read return -1 on error
Modified paths:
  • /branches/ariel/xmldumps-backup/findpageidinbz2xml.c (modified) (history)

Diff [purge]

Index: branches/ariel/xmldumps-backup/findpageidinbz2xml.c
@@ -133,7 +133,7 @@
134134
135135 bfile->bits_shifted = -1;
136136 result = read(fin, bfile->marker_buffer, 7);
137 - if (result < 0) {
 137+ if (result == -1) {
138138 /* fprintf(stderr,"read of file failed\n"); */
139139 return(-1);
140140 }
@@ -202,7 +202,7 @@
203203 int ret, res;
204204
205205 res = lseek(fin,0,SEEK_SET);
206 - if (res < 0) {
 206+ if (res == -1) {
207207 fprintf(stderr,"lseek of file to 0 failed (3)\n");
208208 exit(-1);
209209 }
@@ -242,14 +242,14 @@
243243
244244 if (bfile->bits_shifted == 0) {
245245 res = lseek(fin,bfile->position+1,SEEK_SET);
246 - if (res < 0) {
 246+ if (res == -1) {
247247 fprintf(stderr,"lseek of file to %ld failed (4)\n",(long int) bfile->position+1);
248248 return(-1);
249249 }
250250 }
251251 else {
252252 res = lseek(fin,bfile->position,SEEK_SET);
253 - if (res < 0) {
 253+ if (res == -1) {
254254 fprintf(stderr,"lseek of file to %ld failed (5)\n",(long int) bfile->position);
255255 return(-1);
256256 }
@@ -356,7 +356,7 @@
357357 int res;
358358
359359 res = lseek(fin, 0, SEEK_END);
360 - if (res < 0) {
 360+ if (res == -1) {
361361 fprintf(stderr,"lseek of file to 0 failed (6)\n");
362362 exit(-1);
363363 }
@@ -394,7 +394,7 @@
395395 return(-1);
396396 }
397397 res = lseek(fin, bfile->position, SEEK_SET);
398 - if (res < 0) {
 398+ if (res == -1) {
399399 fprintf(stderr,"lseek of file to %ld failed (7)\n",(long int) bfile->position);
400400 exit(-1);
401401 }
@@ -418,7 +418,7 @@
419419 bfile->eof = 0;
420420 /* leave the file at the right position */
421421 res = lseek(fin, bfile->block_start, SEEK_SET);
422 - if (res < 0) {
 422+ if (res == -1) {
423423 fprintf(stderr,"lseek of file to %ld failed (7)\n",(long int) bfile->position);
424424 exit(-1);
425425 }

Status & tagging log