Ignore:
File:
1 edited

Legend:

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

    rd076f16 rd5c1051  
    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.