> My environment and gcc version are like this:
>
> root@gavin-desktop:~# uname -a
> Linux gavin-desktop 2.6.32-5-xen-amd64 #1 SMP Thu May 19 01:16:47 UTC
> 2011 x86_64 GNU/Linux
>
> root@gavin-desktop:~# gcc -v
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.4.3-4ubuntu5'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> --enable-shared --enable-multiarch --enable-linker-build-id
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> --disable-werror --with-arch-32=i486 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu
> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>
>
>
>
> Thanks,
> Bei Guan
>
>
>
>
>
> 8<------------------------------------------------------
>
> # HG changeset patch
> # User Ian Campbell <
ian.campbell@xxxxxxxxxx>
> # Date 1336751175 -3600
> # Node ID 15ed8f45c4e57a1e206af020e0ff17b792108e99
> # Parent adc74e492edfee6cf44e433e3e93743a3cf71999
> blktap: avoid attribute warn_unused_result build failures.
>
> I'm not proud of this, but since none of these callers of
> read/write have any
> other error handling and return void themselves (for several
> links up the call
> chain AFAICT) and because I don't really want to get into a
> massive reworking
> of blktap2 I suppose it is at least pragmatic
>
> Signed-off-by: Ian Campbell <
ian.campbell@xxxxxxxxxx>
>
> diff -r adc74e492edf -r 15ed8f45c4e5
> tools/blktap2/drivers/tapdisk-log.c
> --- a/tools/blktap2/drivers/tapdisk-log.c Fri May 11
> 16:19:16 2012 +0100
> +++ b/tools/blktap2/drivers/tapdisk-log.c Fri May 11
> 16:46:15 2012 +0100
> @@ -247,7 +247,7 @@ tlog_flush(void)
> wsize = ((size + 511) & (~511));
>
> memset(tapdisk_log.buf + size, '\n', wsize - size);
> - write(fd, tapdisk_log.buf, wsize);
> + (void)write(fd, tapdisk_log.buf, wsize);
>
> tapdisk_log.p = tapdisk_log.buf;
>
> diff -r adc74e492edf -r 15ed8f45c4e5
> tools/blktap2/drivers/tapdisk-queue.c
> --- a/tools/blktap2/drivers/tapdisk-queue.c Fri May 11
> 16:19:16 2012 +0100
> +++ b/tools/blktap2/drivers/tapdisk-queue.c Fri May 11
> 16:46:15 2012 +0100
> @@ -435,7 +435,7 @@ tapdisk_lio_ack_event(struct tqueue *que
> uint64_t val;
>
> if (lio->flags & LIO_FLAG_EVENTFD)
> - read(lio->event_fd, &val, sizeof(val));
> + (void)read(lio->event_fd, &val, sizeof(val));
> }
>
> static void
> diff -r adc74e492edf -r 15ed8f45c4e5
> tools/blktap2/drivers/tapdisk-stream.c
> --- a/tools/blktap2/drivers/tapdisk-stream.c Fri May 11
> 16:19:16 2012 +0100
> +++ b/tools/blktap2/drivers/tapdisk-stream.c Fri May 11
> 16:46:15 2012 +0100
> @@ -145,7 +145,7 @@ tapdisk_stream_poll_clear(struct tapdisk
> {
> int dummy;
>
> - read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> + (void)read(p->pipe[POLL_READ], &dummy, sizeof(dummy));
> p->set = 0;
> }
>
> @@ -155,7 +155,7 @@ tapdisk_stream_poll_set(struct tapdisk_s
> int dummy = 0;
>
> if (!p->set) {
> - write(p->pipe[POLL_WRITE], &dummy,
> sizeof(dummy));
> + (void)write(p->pipe[POLL_WRITE], &dummy,
> sizeof(dummy));
> p->set = 1;
> }
> }
> @@ -203,7 +203,7 @@ tapdisk_stream_print_request(struct tapd
> {
> unsigned long idx = (unsigned
> long)tapdisk_stream_request_idx(s, sreq);
> char *buf = (char *)MMAP_VADDR(s->vbd->ring.vstart,
> idx, 0);
> - write(s->out_fd, buf, sreq->secs << SECTOR_SHIFT);
> + (void)write(s->out_fd, buf, sreq->secs <<
> SECTOR_SHIFT);
> }
>
> static void
> diff -r adc74e492edf -r 15ed8f45c4e5
> tools/blktap2/drivers/tapdisk2.c
> --- a/tools/blktap2/drivers/tapdisk2.c Fri May 11 16:19:16
> 2012 +0100
> +++ b/tools/blktap2/drivers/tapdisk2.c Fri May 11 16:46:15
> 2012 +0100
> @@ -79,7 +79,12 @@ main(int argc, char *argv[])
> if (optind != argc)
> usage(argv[0], EINVAL);
>
> - chdir("/");
> + if (chdir("/")) {
> + DPRINTF("failed to chdir(/): %d\n", errno);
> + err = 1;
> + goto out;
> + }
> +
> tapdisk_start_logging("tapdisk2");
>
> err = tapdisk_server_init();
>
>
>
>
>
> --
> Best Regards,
> Bei Guan
>