PageRenderTime 42ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/ncftp-3.2.5/sio/USendtoByName.c

#
C | 25 lines | 20 code | 5 blank | 0 comment | 8 complexity | 1702022a3a7396ded355c09a9518a259 MD5 | raw file
Possible License(s): AGPL-3.0
  1. #include "syshdrs.h"
  2. #ifdef PRAGMA_HDRSTOP
  3. # pragma hdrstop
  4. #endif
  5. #ifdef HAVE_SYS_UN_H
  6. int
  7. USendtoByName(int sfd, const char *const buf, size_t size, int fl, const char *const toAddrStr, int tlen)
  8. {
  9. struct sockaddr_un toAddr;
  10. int ualen;
  11. int result;
  12. if ((toAddrStr == NULL) || (toAddrStr[0] == '\0') || (size == 0) || (buf == NULL)) {
  13. errno = EINVAL;
  14. return (-1);
  15. }
  16. ualen = (int) MakeSockAddrUn(&toAddr, toAddrStr);
  17. result = USendto(sfd, buf, size, fl, &toAddr, ualen, tlen);
  18. return (result);
  19. } /* USendtoByName */
  20. #endif /* HAVE_SYS_UN_H */