hcseriald.c (137135) | hcseriald.c (188130) |
---|---|
1/* 2 * hcseriald.c 3 * 4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $Id: hcseriald.c,v 1.3 2003/05/21 22:40:32 max Exp $ | 1/* 2 * hcseriald.c 3 * 4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $Id: hcseriald.c,v 1.3 2003/05/21 22:40:32 max Exp $ |
29 * $FreeBSD: head/usr.sbin/bluetooth/hcseriald/hcseriald.c 137135 2004-11-02 20:12:06Z emax $ | 29 * $FreeBSD: head/usr.sbin/bluetooth/hcseriald/hcseriald.c 188130 2009-02-04 22:04:06Z emax $ |
30 */ 31 32#include <sys/types.h> 33#include <sys/ioctl.h> 34 35#include <netgraph/ng_message.h> 36#include <netgraph.h> 37#include <netgraph/bluetooth/include/ng_h4.h> --- 58 unchanged lines hidden (view full) --- 96 if (device == NULL || name == NULL) 97 usage(argv[0]); 98 99 openlog(hcseriald, LOG_PID | LOG_NDELAY, LOG_USER); 100 101 /* Open device */ 102 n = open_device(device, speed, name); 103 | 30 */ 31 32#include <sys/types.h> 33#include <sys/ioctl.h> 34 35#include <netgraph/ng_message.h> 36#include <netgraph.h> 37#include <netgraph/bluetooth/include/ng_h4.h> --- 58 unchanged lines hidden (view full) --- 96 if (device == NULL || name == NULL) 97 usage(argv[0]); 98 99 openlog(hcseriald, LOG_PID | LOG_NDELAY, LOG_USER); 100 101 /* Open device */ 102 n = open_device(device, speed, name); 103 |
104 if (detach) { 105 pid_t pid = fork(); 106 107 if (pid == (pid_t) -1) { 108 syslog(LOG_ERR, "Could not fork(). %s (%d)", 109 strerror(errno), errno); 110 exit(1); 111 } 112 113 if (pid != 0) 114 exit(0); 115 116 if (daemon(0, 0) < 0) { 117 syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)", 118 strerror(errno), errno); 119 exit(1); 120 } | 104 if (detach && daemon(0, 0) < 0) { 105 syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)", 106 strerror(errno), errno); 107 exit(1); |
121 } 122 123 /* Write PID file */ 124 snprintf(p, sizeof(p), "/var/run/%s.%s.pid", hcseriald, name); 125 f = fopen(p, "w"); 126 if (f == NULL) { 127 syslog(LOG_ERR, "Could not fopen(%s). %s (%d)", 128 p, strerror(errno), errno); --- 153 unchanged lines hidden --- | 108 } 109 110 /* Write PID file */ 111 snprintf(p, sizeof(p), "/var/run/%s.%s.pid", hcseriald, name); 112 f = fopen(p, "w"); 113 if (f == NULL) { 114 syslog(LOG_ERR, "Could not fopen(%s). %s (%d)", 115 p, strerror(errno), errno); --- 153 unchanged lines hidden --- |