Ignore:
File:
1 edited

Legend:

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

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