Changeset fb31682 in mainline for uspace/lib/pcap/src/pcap_dumper.c
- Timestamp:
- 2024-12-13T08:44:05Z (10 months ago)
- Children:
- 87b490e3
- Parents:
- 28ed2d89
- git-author:
- Nataliia Korop <n.corop08@…> (2024-11-29 10:41:19)
- git-committer:
- Nataliia Korop <n.corop08@…> (2024-12-13 08:44:05)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcap/src/pcap_dumper.c
r28ed2d89 rfb31682 39 39 #include "pcap_dumper.h" 40 40 41 #define SHORT_OPS_BYTE_COUNT 6041 #define SHORT_OPS_BYTE_COUNT 0x3C 42 42 43 43 /** Initialize writing to .pcap file. … … 50 50 static errno_t pcap_writer_to_file_init(pcap_writer_t *writer, const char *filename) 51 51 { 52 /** For overwriting file if already exists. */ 53 writer->data = fopen(filename, "w"); 54 if (writer->data == NULL) { 55 return EINVAL; 56 } 57 fclose(writer->data); 58 52 59 writer->data = fopen(filename, "a"); 53 60 if (writer->data == NULL) { … … 71 78 static errno_t pcap_writer_to_file_usb_init(pcap_writer_t *writer, const char *filename) 72 79 { 80 /** For overwriting file if already exists. */ 81 writer->data = fopen(filename, "w"); 82 if (writer->data == NULL) { 83 return EINVAL; 84 } 85 fclose(writer->data); 86 73 87 writer->data = fopen(filename, "a"); 74 88 if (writer->data == NULL) { … … 140 154 }; 141 155 142 static pcap_writer_ops_t ops[4] = { file_ops, short_file_ops, append_file_ops, usb_file_ops};156 static pcap_writer_ops_t ops[4] = { file_ops, short_file_ops, append_file_ops, usb_file_ops }; 143 157 144 158 int pcap_dumper_get_ops_number(void) … … 150 164 { 151 165 fibril_mutex_lock(&dumper->mutex); 152 153 /** When try to start when already started, close current and starts new */154 if (dumper->to_dump) {155 pcap_dumper_stop(dumper);156 }157 166 158 167 errno_t rc = dumper->writer.ops->open(&dumper->writer, name); … … 201 210 } 202 211 203 204 205 212 /** @} 206 213 */
Note:
See TracChangeset
for help on using the changeset viewer.