Mercurial > gftp.yaz
comparison lib/sockutils.c @ 952:a490d94a5b8e
2008-03-28 Brian Masney <masneyb@gftp.org>
* lib/Makefile.am lib/misc.c lib/socket-connect.c
lib/socket-connect-getaddrinfo.c lib/socket-connect-gethostbyname.c
lib/sockutils.c lib/gftp.h - cleaned up more of the socket functions
and split them up into their own files. Cleanups and bug fixes to the
DNS lookup code.
author | masneyb |
---|---|
date | Fri, 28 Mar 2008 11:44:36 +0000 |
parents | c7d7a081cd9c |
children |
comparison
equal
deleted
inserted
replaced
951:99f8858bbf02 | 952:a490d94a5b8e |
---|---|
356 } | 356 } |
357 | 357 |
358 return (0); | 358 return (0); |
359 } | 359 } |
360 | 360 |
361 | |
362 struct servent * | |
363 r_getservbyname (const char *name, const char *proto, | |
364 struct servent *result_buf, int *h_errnop) | |
365 { | |
366 static GStaticMutex servfunclock = G_STATIC_MUTEX_INIT; | |
367 struct servent *sent; | |
368 | |
369 if (g_thread_supported ()) | |
370 g_static_mutex_lock (&servfunclock); | |
371 | |
372 if ((sent = getservbyname (name, proto)) == NULL) | |
373 { | |
374 if (h_errnop) | |
375 *h_errnop = h_errno; | |
376 } | |
377 else | |
378 { | |
379 *result_buf = *sent; | |
380 sent = result_buf; | |
381 } | |
382 | |
383 if (g_thread_supported ()) | |
384 g_static_mutex_unlock (&servfunclock); | |
385 return (sent); | |
386 } | |
387 |