diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2011-01-09 16:22:09 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2011-01-09 16:22:09 +0800 |
commit | 80db2c0b826e4e079ea548c98b308ac5b2fe541f (patch) | |
tree | bbc010cc963e7d6f0f1ce4da7b3e5d28a1fc767b | |
parent | 61642c585dd6cd62de5dc2b36f80cbc7b81624d7 (diff) | |
download | pttbbs-80db2c0b826e4e079ea548c98b308ac5b2fe541f.tar pttbbs-80db2c0b826e4e079ea548c98b308ac5b2fe541f.tar.gz pttbbs-80db2c0b826e4e079ea548c98b308ac5b2fe541f.tar.bz2 pttbbs-80db2c0b826e4e079ea548c98b308ac5b2fe541f.tar.lz pttbbs-80db2c0b826e4e079ea548c98b308ac5b2fe541f.tar.xz pttbbs-80db2c0b826e4e079ea548c98b308ac5b2fe541f.tar.zst pttbbs-80db2c0b826e4e079ea548c98b308ac5b2fe541f.zip |
Allow callback function to return different status
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5292 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/common/sys/record.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pttbbs/common/sys/record.c b/pttbbs/common/sys/record.c index b0badd12..d91df1e9 100644 --- a/pttbbs/common/sys/record.c +++ b/pttbbs/common/sys/record.c @@ -290,7 +290,7 @@ apply_record(const char *fpath, int (*fptr) (void *item, void *optarg), size_t size, void *arg) { char buf[BUFSIZE]; - int fd; + int fd, ret; assert(size <= sizeof(buf)); @@ -298,9 +298,9 @@ apply_record(const char *fpath, int (*fptr) (void *item, void *optarg), return -1; while (read(fd, buf, size) == size) - if ((*fptr) (buf, arg) == 1) { + if ((ret = (*fptr) (buf, arg)) != 0) { close(fd); - return 1; + return ret; } close(fd); |