MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsPutFile

Function cupsPutFile

cups/getputfile.c:518–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516 */
517
518http_status_t /* O - HTTP status */
519cupsPutFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
520 const char *resource, /* I - Resource name */
521 const char *filename) /* I - Filename */
522{
523 int fd; /* File descriptor */
524 http_status_t status; /* Status */
525
526
527 /*
528 * Range check input...
529 */
530
531 if (!http || !resource || !filename)
532 {
533 if (http)
534 http->error = EINVAL;
535
536 return (HTTP_STATUS_ERROR);
537 }
538
539 /*
540 * Open the local file...
541 */
542
543 if ((fd = open(filename, O_RDONLY)) < 0)
544 {
545 /*
546 * Couldn't open the file!
547 */
548
549 http->error = errno;
550
551 return (HTTP_STATUS_ERROR);
552 }
553
554 /*
555 * Put the file...
556 */
557
558 status = cupsPutFd(http, resource, fd);
559
560 close(fd);
561
562 return (status);
563}

Callers 3

do_config_serverFunction · 0.85
mainFunction · 0.85

Calls 1

cupsPutFdFunction · 0.85

Tested by

no test coverage detected