MCPcopy Create free account
hub / github.com/apache/trafficserver / fopen

Method fopen

src/api/InkAPIInternal.cc:311–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311int
312FileImpl::fopen(const char *filename, const char *mode)
313{
314 if (mode[0] == '\0') {
315 return 0;
316 } else if (mode[0] == 'r') {
317 if (mode[1] != '\0') {
318 return 0;
319 }
320 m_mode = READ;
321 m_fd = open(filename, O_RDONLY);
322 } else if (mode[0] == 'w') {
323 if (mode[1] != '\0') {
324 return 0;
325 }
326 m_mode = WRITE;
327 m_fd = open(filename, O_WRONLY | O_CREAT, 0644);
328 } else if (mode[0] == 'a') {
329 if (mode[1] != '\0') {
330 return 0;
331 }
332 m_mode = WRITE;
333 m_fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, 0644);
334 }
335
336 if (m_fd < 0) {
337 m_mode = CLOSED;
338 return 0;
339 } else {
340 return 1;
341 }
342}
343
344void
345FileImpl::fclose()

Callers 1

TSfopenFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected