Revision d39facc7

View differences:

tools/cws2fws.c
69 69

  
70 70
    // write out modified header
71 71
    buf_in[0] = 'F';
72
    write(fd_out, &buf_in, 8);
72
    if (write(fd_out, &buf_in, 8) < 8) {
73
        perror("Error writing output file");
74
        exit(1);
75
    }
73 76

  
74 77
    zstream.zalloc = NULL;
75 78
    zstream.zfree = NULL;
......
101 104
            zstream.avail_in, zstream.total_in, zstream.avail_out, zstream.total_out,
102 105
            zstream.total_out-last_out);
103 106

  
104
        write(fd_out, &buf_out, zstream.total_out-last_out);
107
        if (write(fd_out, &buf_out, zstream.total_out - last_out) < zstream.total_out - last_out) {
108
            perror("Error writing output file");
109
            exit(1);
110
        }
105 111

  
106 112
        i += len;
107 113

  
......
120 126
        buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff;
121 127

  
122 128
        lseek(fd_out, 4, SEEK_SET);
123
        write(fd_out, &buf_in, 4);
129
        if (write(fd_out, &buf_in, 4) < 4) {
130
            perror("Error writing output file");
131
            exit(1);
132
        }
124 133
    }
125 134

  
126 135
    inflateEnd(&zstream);
tools/pktdumper.c
104 104
        //printf("open(\"%s\")\n", pktfilename);
105 105
        if (!nowrite) {
106 106
            fd = open(pktfilename, O_WRONLY|O_CREAT, 0644);
107
            write(fd, pkt.data, pkt.size);
107
            err = write(fd, pkt.data, pkt.size);
108
            if (err < 0) {
109
                fprintf(stderr, "write: error %d\n", err);
110
                return 1;
111
            }
108 112
            close(fd);
109 113
        }
110 114
        av_free_packet(&pkt);

Also available in: Unified diff