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

Re: [E-devel] fd leak in ecore_con_dns_lookup?

On Sat, 10 Jun 2006 12:58:16 -0500 "Matthew R. Dempsky" <mrd@alkemio.org>

> While trying to compile ecore on OpenBSD, the build failed on 
> ecore_con_dns.c because OpenBSD doesn't have <arpa/nameser_compat.h>, 
> but commenting out that include line lets it build fine.
> While looking through the file, I looked at ecore_con_dns_lookup, and it 
> looks like fd[1] is leaked whenever the function is successful.  Also, 
> the possibility of fork() failing is ignored.  (I'll submit patches for 
> these if anyone can confirm they're bugs.)
> Finally, it looks like a custom DNS client library is included (but 
> commented out).  Are there any long term plans regarding this code?

that basically was a dns client lookup. the problem is it didn't
handle /etc/hosts, /etc/nsswitch.conf etc. etc. it was a good bit of work by
seb - but it needed a fair bit more. i decided to move it to a forked child and
pipe back to the parent model.

now to the code. the child fork (in the /* CHILD */ commented section) doesn't
matter as it just exits anyway - losing any fd's.  note that that code sets up
sets up 2 callbacks. one for the exit of the child process and another for the
fd handler (when data comes down the fd). when they get their data - they close
the fd[0] when they get their data - but not fd[1] - true. so yes. fd leak.
fixed now :)

> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster@rasterman.com
Tokyo, Japan (東京 日本)