Changeset 132ab5d1 in mainline for uspace/app/websrv/websrv.c


Ignore:
Timestamp:
2018-01-30T03:20:45Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a6cc679
Parents:
8bfb163 (diff), 6a5d05b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge commit '6a5d05bd2551e64111bea4f9332dd7448c26ce84' into forwardport

Separate return value from error code in gen_irq_code*().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/websrv/websrv.c

    r8bfb163 r132ab5d1  
    168168                rc = tcp_conn_recv_wait(recv->conn, recv->rbuf, BUFFER_SIZE, &nrecv);
    169169                if (rc != EOK) {
    170                         fprintf(stderr, "tcp_conn_recv() failed (%d)\n", rc);
     170                        fprintf(stderr, "tcp_conn_recv() failed: %s\n", str_error(rc));
    171171                        return rc;
    172172                }
     
    247247        char *fname = NULL;
    248248        int rc;
     249        size_t nr;
    249250        int fd = -1;
    250251       
     
    258259                uri = "/index.html";
    259260       
    260         rc = asprintf(&fname, "%s%s", WEB_ROOT, uri);
    261         if (rc < 0) {
     261        if (asprintf(&fname, "%s%s", WEB_ROOT, uri) < 0) {
    262262                rc = ENOMEM;
    263263                goto out;
    264264        }
    265265       
    266         fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
    267         if (fd < 0) {
     266        rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);
     267        if (rc != EOK) {
    268268                rc = send_response(conn, msg_not_found);
    269269                goto out;
     
    279279        aoff64_t pos = 0;
    280280        while (true) {
    281                 ssize_t nr = vfs_read(fd, &pos, fbuf, BUFFER_SIZE);
     281                rc = vfs_read(fd, &pos, fbuf, BUFFER_SIZE, &nr);
     282                if (rc != EOK)
     283                        goto out;
     284               
    282285                if (nr == 0)
    283286                        break;
    284                
    285                 if (nr < 0) {
    286                         rc = EIO;
    287                         goto out;
    288                 }
    289287               
    290288                rc = tcp_conn_send(conn, fbuf, nr);
Note: See TracChangeset for help on using the changeset viewer.