Message ID | 1417450537-7640-2-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | New |
Headers | show |
On 2014-12-01 19:15, Maxim Uvarov wrote: > In case of stdin is not attached socket() can return 0 for valid > socket fd. Not initialized socket has to be -1. > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > platform/linux-generic/odp_packet_io.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index c523350..acc03bb 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -114,6 +114,9 @@ static void init_pktio_entry(pktio_entry_t *entry) > entry->s.inq_default = ODP_QUEUE_INVALID; > memset(&entry->s.pkt_sock, 0, sizeof(entry->s.pkt_sock)); > memset(&entry->s.pkt_sock_mmap, 0, sizeof(entry->s.pkt_sock_mmap)); > + /* valid socket() might be 0, set not initialized socket to -1 */ /* set it to -1, because a valid socked might be initialized to 0 */ > + entry->s.pkt_sock.sockfd = -1; > + entry->s.pkt_sock_mmap.sockfd = -1; > } > > static odp_pktio_t alloc_lock_pktio_entry(void) > -- > 1.8.5.1.163.gd7aced9 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index c523350..acc03bb 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -114,6 +114,9 @@ static void init_pktio_entry(pktio_entry_t *entry) entry->s.inq_default = ODP_QUEUE_INVALID; memset(&entry->s.pkt_sock, 0, sizeof(entry->s.pkt_sock)); memset(&entry->s.pkt_sock_mmap, 0, sizeof(entry->s.pkt_sock_mmap)); + /* valid socket() might be 0, set not initialized socket to -1 */ + entry->s.pkt_sock.sockfd = -1; + entry->s.pkt_sock_mmap.sockfd = -1; } static odp_pktio_t alloc_lock_pktio_entry(void)
In case of stdin is not attached socket() can return 0 for valid socket fd. Not initialized socket has to be -1. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- platform/linux-generic/odp_packet_io.c | 3 +++ 1 file changed, 3 insertions(+)