Giter Site home page Giter Site logo

Comments (6)

r00t- avatar r00t- commented on September 24, 2024

see also #32 (comment)

from libsml.

r00t- avatar r00t- commented on September 24, 2024

fix goes here:
https://github.com/volkszaehler/libsml/blob/master/sml/src/sml_transport.c#L111

from libsml.

devZer0 avatar devZer0 commented on September 24, 2024

did you test that with my binary dumps? fix does not work for me

from libsml.

andig avatar andig commented on September 24, 2024

fix does not work for me

That's why its work in progress.

from libsml.

devZer0 avatar devZer0 commented on September 24, 2024

sorry, that was not clear to me.

i found http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html
-snipp-
When attempting to read from an empty pipe or FIFO:
If no process has the pipe open for writing, read() shall return 0 to indicate end-of-file.
-snipp-

and added check for if read returns "0" likes see below.

that works for me, but i'm not sure if it's the correct way to handle that, i'm an awful bad programmer.

size_t sml_read(int fd, fd_set *set, unsigned char *buffer, size_t len) {

    ssize_t r = 0;
    size_t tr = 0;

    while (tr < len) {
            select(fd + 1, set, 0, 0, 0);
            if (FD_ISSET(fd, set)) {
                    r = read(fd, &(buffer[tr]), len - tr);
                    if (r == 0 )break;
                    if (r < 0 ) continue;

                    tr += r;
            }
    }
    return tr;

}

from libsml.

andig avatar andig commented on September 24, 2024

Fixed by #51

from libsml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.