RFC on file_store()

Pavel Roskin proski at gnu.org
Sat Jun 16 01:20:54 UTC 2001


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





More information about the mc-devel mailing list