RFC on file_store()



Hello, Pavel!

I've just discovered a very suspicious piece of code in fish.c, function
file_store():

    while (1) {
        while ((n = read(h, buffer, sizeof(buffer))) < 0) {
            if ((errno == EINTR) && got_interrupt)
                continue;
            print_vfs_message(_("fish: Local read failed, sending zeros") );
            close(h);
            h = open( "/dev/zero", O_RDONLY );
        }
        if (n == 0)
            break;

You are using got_interrupt without parentheses. It's always true. But do
you really mean to continue if the user tries to interrupt the command?

It may happen that some data has been read. Then n will be positive, but
still the user interrupt should be honored.

Sending zeroes is very bad. It means corrupted data on the remote side. Is
it possible to send break instead?

-- 
Regards,
Pavel Roskin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]