- **status**: accepted --> review


---

** [tickets:#645] nid: Infinite loops when system calls fail**

**Status:** review
**Created:** Mon Dec 02, 2013 02:02 PM UTC by Anders Widell
**Last Updated:** Mon Dec 02, 2013 02:02 PM UTC
**Owner:** Anders Widell

There are several places in nodeinit.c where a while-loop can potentially 
become infinite if the system call returns -1. The code looks for example like 
this:

        while ((n = select(filedes[0] + 1, &set, NULL, NULL, &tv)) <= 0) {
                if (n == 0) {
                        LOG_ER("Writer couldn't return PID");
                        close(filedes[0]);
                        return tmp_pid;
                }
                if (errno == EINTR)
                        continue;
        }

Another example:

                while (write(filedes[1], &tmp_pid, sizeof(int)) < 0) {
                        if (errno == EINTR)
                                continue;
                        else if (errno == EPIPE) {
                                LOG_ER("Reader not available to return my PID");
                                exit(2);
                        } else {
                                LOG_ER("Problem writing to pipe, err=%s", 
strerror(errno));
                        }
                }



---

Sent from sourceforge.net because opensaf-tickets@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-tickets mailing list
Opensaf-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to