Lines 706-722
Link Here
|
706 |
l = rtm->rtm_msglen; |
706 |
l = rtm->rtm_msglen; |
707 |
rtm->rtm_seq = ++seq; |
707 |
rtm->rtm_seq = ++seq; |
708 |
rtm->rtm_type = cmd; |
708 |
rtm->rtm_type = cmd; |
709 |
if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) { |
709 |
if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) { |
710 |
if (errno != ESRCH || cmd != RTM_DELETE) { |
710 |
if (errno != ESRCH || cmd != RTM_DELETE) { |
711 |
warn("writing to routing socket"); |
711 |
warn("writing to routing socket"); |
712 |
return (NULL); |
712 |
return (NULL); |
713 |
} |
713 |
} |
714 |
} |
714 |
} |
715 |
do { |
715 |
do { |
716 |
l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg)); |
716 |
l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg)); |
|
|
717 |
if ( l > 0 && rtm->rtm_seq == 0 && rtm->rtm_pid == 0 ) |
718 |
return (NULL); /* something weird happened */ |
717 |
} while (l > 0 && (rtm->rtm_seq != seq || rtm->rtm_pid != pid)); |
719 |
} while (l > 0 && (rtm->rtm_seq != seq || rtm->rtm_pid != pid)); |
718 |
if (l < 0) |
720 |
if (l < 0) |
719 |
warn("read from routing socket"); |
721 |
warn("read from routing socket"); |
720 |
return (rtm); |
722 |
return (rtm); |
721 |
} |
723 |
} |