Fix sequence of parameters. The size is the second parameter of fwrite,

the nitems the third, not vice versa.

svn path=/trunk/; revision=46592
This commit is contained in:
Michael Tüxen 2012-12-18 18:18:11 +00:00
parent 7cf5334332
commit f55922be77
1 changed files with 4 additions and 4 deletions

View File

@ -180,7 +180,7 @@ struct option {
do { \
size_t nwritten; \
\
nwritten = fwrite(data_pointer, 1, data_length, file_pointer); \
nwritten = fwrite(data_pointer, data_length, 1, file_pointer); \
if (nwritten != data_length) { \
if (nwritten == 0 && ferror(file_pointer)) { \
*error_pointer = errno; \
@ -223,7 +223,7 @@ libpcap_write_file_header(FILE *fp, int linktype, int snaplen, gboolean ts_nsecs
file_hdr.sigfigs = 0; /* unknown, but also apparently unused */
file_hdr.snaplen = snaplen;
file_hdr.network = linktype;
nwritten = fwrite(&file_hdr, 1, sizeof(file_hdr), fp);
nwritten = fwrite(&file_hdr, sizeof(file_hdr), 1, fp);
if (nwritten != sizeof(file_hdr)) {
if (nwritten == 0 && ferror(fp))
*err = errno;
@ -249,7 +249,7 @@ libpcap_write_packet(FILE *fp, const struct pcap_pkthdr *phdr, const u_char *pd,
rec_hdr.ts_usec = phdr->ts.tv_usec;
rec_hdr.incl_len = phdr->caplen;
rec_hdr.orig_len = phdr->len;
nwritten = fwrite(&rec_hdr, 1, sizeof rec_hdr, fp);
nwritten = fwrite(&rec_hdr, sizeof(rec_hdr), 1, fp);
if (nwritten != sizeof rec_hdr) {
if (nwritten == 0 && ferror(fp))
*err = errno;
@ -259,7 +259,7 @@ libpcap_write_packet(FILE *fp, const struct pcap_pkthdr *phdr, const u_char *pd,
}
*bytes_written += sizeof rec_hdr;
nwritten = fwrite(pd, 1, phdr->caplen, fp);
nwritten = fwrite(pd, phdr->caplen, 1, fp);
if (nwritten != phdr->caplen) {
if (nwritten == 0 && ferror(fp))
*err = errno;