Changeset 252 for trunk/src/sh_socket.c
- Timestamp:
- Oct 12, 2009, 10:40:45 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_socket.c
r200 r252 396 396 if (sizeof(name.sun_path) < (1 + sl_strlen(sh_sockname))) 397 397 { 398 close(pf_unix_fd); pf_unix_fd = -1;398 sl_close_fd(FIL__, __LINE__, pf_unix_fd); pf_unix_fd = -1; 399 399 sh_error_handle ((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 400 400 _("PID dir path too long"), … … 418 418 if (sh_socket_remove() < 0) 419 419 { 420 close(pf_unix_fd); pf_unix_fd = -1;420 sl_close_fd(FIL__, __LINE__, pf_unix_fd); pf_unix_fd = -1; 421 421 sh_error_handle ((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 422 422 _("Unlink of socket failed, maybe path not trusted"), … … 428 428 if (bind ((pf_unix_fd), (struct sockaddr *) &name, size) < 0) 429 429 { 430 close(pf_unix_fd); pf_unix_fd = -1;430 sl_close_fd(FIL__, __LINE__, pf_unix_fd); pf_unix_fd = -1; 431 431 sh_error_handle ((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 432 432 sh_error_message (errno, errbuf, sizeof(errbuf)), … … 439 439 &optval, sizeof(optval))) 440 440 { 441 close(pf_unix_fd); pf_unix_fd = -1;441 sl_close_fd(FIL__, __LINE__, pf_unix_fd); pf_unix_fd = -1; 442 442 sh_error_handle ((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 443 443 sh_error_message (errno, errbuf, sizeof(errbuf)), … … 450 450 if (flags < 0) 451 451 { 452 close(pf_unix_fd); pf_unix_fd = -1;452 sl_close_fd(FIL__, __LINE__, pf_unix_fd); pf_unix_fd = -1; 453 453 sh_error_handle ((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 454 454 sh_error_message (errno, errbuf, sizeof(errbuf)), … … 460 460 if (flags < 0) 461 461 { 462 close(pf_unix_fd); pf_unix_fd = -1;462 sl_close_fd(FIL__, __LINE__, pf_unix_fd); pf_unix_fd = -1; 463 463 sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 464 464 sh_error_message (errno, errbuf, sizeof(errbuf)), … … 469 469 if (0 != listen(pf_unix_fd, 5)) 470 470 { 471 close(pf_unix_fd); pf_unix_fd = -1;471 sl_close_fd(FIL__, __LINE__, pf_unix_fd); pf_unix_fd = -1; 472 472 sh_error_handle ((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 473 473 sh_error_message (errno, errbuf, sizeof(errbuf)), … … 630 630 sh_error_message (errno, errbuf, sizeof(errbuf)), 631 631 _("sh_socket_read: setsockopt")); 632 close(talkfd);632 sl_close_fd(FIL__, __LINE__, talkfd); 633 633 return -1; 634 634 } … … 643 643 sh_error_message (errno, errbuf, sizeof(errbuf)), 644 644 _("sh_socket_read: recvmsg")); 645 close(talkfd);645 sl_close_fd(FIL__, __LINE__, talkfd); 646 646 return -1; 647 647 } … … 666 666 { 667 667 /* no data */ 668 close(talkfd);668 sl_close_fd(FIL__, __LINE__, talkfd); 669 669 return 0; 670 670 } … … 672 672 sh_error_message (errno, errbuf, sizeof(errbuf)), 673 673 _("sh_socket_read: recvfrom")); 674 close(talkfd);674 sl_close_fd(FIL__, __LINE__, talkfd); 675 675 return -1; 676 676 } … … 682 682 sh_error_message (errno, errbuf, sizeof(errbuf)), 683 683 _("sh_socket_read: getpeereid")); 684 close(talkfd);684 sl_close_fd(FIL__, __LINE__, talkfd); 685 685 return -1; 686 686 } … … 693 693 sh_error_message (errno, errbuf, sizeof(errbuf)), 694 694 _("sh_socket_read: getsockopt")); 695 close(talkfd);695 sl_close_fd(FIL__, __LINE__, talkfd); 696 696 return -1; 697 697 } … … 744 744 fdmax = data_size / sizeof(int); 745 745 for (fdcount = 0; fdcount < fdmax; ++fdcount) 746 (void) close(fdsbuf[fdcount]);746 (void) sl_close_fd(FIL__, __LINE__, fdsbuf[fdcount]); 747 747 } 748 748 } 749 749 750 close(talkfd);750 sl_close_fd(FIL__, __LINE__, talkfd); 751 751 return -1; 752 752 } … … 775 775 _("sh_socket_read")); 776 776 sh_set_sockpass(); 777 close(talkfd);777 sl_close_fd(FIL__, __LINE__, talkfd); 778 778 return -1; 779 779 } … … 782 782 _("Socket credentials not supported on this OS"), 783 783 _("sh_socket_read")); 784 close(talkfd);784 sl_close_fd(FIL__, __LINE__, talkfd); 785 785 return -1; 786 786 #endif … … 796 796 _("client does not have required uid"), 797 797 _("sh_socket_read: getsockopt")); 798 close(talkfd);798 sl_close_fd(FIL__, __LINE__, talkfd); 799 799 return -1; 800 800 } … … 816 816 _("Bad message format: command too long"), 817 817 _("sh_socket_read")); 818 close(talkfd);818 sl_close_fd(FIL__, __LINE__, talkfd); 819 819 return -1; 820 820 } … … 824 824 _("Bad message format: hostname too long"), 825 825 _("sh_socket_read")); 826 close(talkfd);826 sl_close_fd(FIL__, __LINE__, talkfd); 827 827 return -1; 828 828 } … … 848 848 _("Bad message format"), 849 849 _("sh_socket_read")); 850 close(talkfd);850 sl_close_fd(FIL__, __LINE__, talkfd); 851 851 return -1; 852 852 } … … 865 865 */ 866 866 nbytes = send (talkfd, cmd, strlen(cmd) + 1, 0); 867 close(talkfd);867 sl_close_fd(FIL__, __LINE__, talkfd); 868 868 if (nbytes < 0) 869 869 { … … 904 904 sh_error_message (errno, errbuf, sizeof(errbuf)), 905 905 _("sh_socket_read: sendto")); 906 close(talkfd);906 sl_close_fd(FIL__, __LINE__, talkfd); 907 907 return -1; 908 908 } … … 935 935 sh_error_message (errno, errbuf, sizeof(errbuf)), 936 936 _("sh_socket_read: sendto")); 937 close(talkfd);937 sl_close_fd(FIL__, __LINE__, talkfd); 938 938 return -1; 939 939 } … … 946 946 */ 947 947 nbytes = send (talkfd, _("END"), 4, 0); 948 close(talkfd);948 sl_close_fd(FIL__, __LINE__, talkfd); 949 949 return 0; 950 950 }
Note:
See TracChangeset
for help on using the changeset viewer.