X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=test%2Fsrc%2Ffd.c;h=fc3a544564972209a932667a10997c799268e90b;hb=c4b4086235b1d5e21fcf1ad72a1b05813e15dcbd;hp=12a8dbc487a3aa10e9d3d820dbc55b29b679a7b8;hpb=3634fc257bd0667daef14d72005cd87c735bbb24;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/test/src/fd.c b/test/src/fd.c index 12a8dbc48..fc3a54456 100644 --- a/test/src/fd.c +++ b/test/src/fd.c @@ -50,7 +50,8 @@ if (filter) { int len; while ((len = read(0, buffer, sizeof(buffer))) > 0) - write(1, buffer, len); + if (write(1, buffer, len) < 0) + exit(1); } p += sprintf(p, "max fd = %d\n", (int)mac_maxfd); @@ -64,28 +65,21 @@ for (fd = 0; fd <= mac_maxfd; fd++) p += sprintf(p, "%3d opt=%d status=%X ", fd, options, status); switch(status & 3) { - case 0: p += sprintf(p, "RDONLY"); - break; - case 1: p += sprintf(p, "WRONLY"); - break; - case 2: p += sprintf(p, "RDWR"); - break; + case O_RDONLY: p += sprintf(p, "RDONLY"); break; + case O_WRONLY: p += sprintf(p, "WRONLY"); break; + case O_RDWR: p += sprintf(p, "RDWR"); break; } if (isatty(fd)) p += sprintf(p, " TTY"); if ((status & 8) != 0) p += sprintf(p, " APPEND"); if (use_stat && fstat(fd, &statbuf) >= 0) - { p += sprintf(p, " mode=%o uid=%d size=%d", (int)statbuf.st_mode, (int)statbuf.st_uid, (int)statbuf.st_size); - } p += sprintf(p, "\n"); } else if (errno != EBADF) - { p += sprintf(p, "%3d errno=%d %s\n", fd, errno, strerror(errno)); - } } if (qpgm)