Deleted Added
full compact
rfcomm_pppd.c (177174) rfcomm_pppd.c (188130)
1/*
2 * rfcomm_pppd.c
3 */
4
5/*-
6 * Copyright (c) 2001-2008 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7 * All rights reserved.
8 *

--- 14 unchanged lines hidden (view full) ---

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * $Id: rfcomm_pppd.c,v 1.5 2003/09/07 18:32:11 max Exp $
1/*
2 * rfcomm_pppd.c
3 */
4
5/*-
6 * Copyright (c) 2001-2008 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7 * All rights reserved.
8 *

--- 14 unchanged lines hidden (view full) ---

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * $Id: rfcomm_pppd.c,v 1.5 2003/09/07 18:32:11 max Exp $
31 * $FreeBSD: head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c 177174 2008-03-14 16:29:25Z emax $
31 * $FreeBSD: head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c 188130 2009-02-04 22:04:06Z emax $
32 */
33
34#include <bluetooth.h>
35#include <ctype.h>
36#include <err.h>
37#include <errno.h>
38#include <fcntl.h>
39#include <sdp.h>

--- 121 unchanged lines hidden (view full) ---

161 errc(1, s, "Could not obtain RFCOMM channel");
162 }
163
164 if (channel <= 0 || channel > 30)
165 errx(1, "Invalid RFCOMM channel number %d", channel);
166
167 openlog(RFCOMM_PPPD, LOG_PID | LOG_PERROR | LOG_NDELAY, LOG_USER);
168
32 */
33
34#include <bluetooth.h>
35#include <ctype.h>
36#include <err.h>
37#include <errno.h>
38#include <fcntl.h>
39#include <sdp.h>

--- 121 unchanged lines hidden (view full) ---

161 errc(1, s, "Could not obtain RFCOMM channel");
162 }
163
164 if (channel <= 0 || channel > 30)
165 errx(1, "Invalid RFCOMM channel number %d", channel);
166
167 openlog(RFCOMM_PPPD, LOG_PID | LOG_PERROR | LOG_NDELAY, LOG_USER);
168
169 if (detach) {
170 pid = fork();
171 if (pid == (pid_t) -1) {
172 syslog(LOG_ERR, "Could not fork(). %s (%d)",
173 strerror(errno), errno);
174 exit(1);
175 }
176
177 if (pid != 0)
178 exit(0);
179
180 if (daemon(0, 0) < 0) {
181 syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
182 strerror(errno), errno);
183 exit(1);
184 }
169 if (detach && daemon(0, 0) < 0) {
170 syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
171 strerror(errno), errno);
172 exit(1);
185 }
186
187 s = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM);
188 if (s < 0) {
189 syslog(LOG_ERR, "Could not create socket. %s (%d)",
190 strerror(errno), errno);
191 exit(1);
192 }

--- 291 unchanged lines hidden ---
173 }
174
175 s = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM);
176 if (s < 0) {
177 syslog(LOG_ERR, "Could not create socket. %s (%d)",
178 strerror(errno), errno);
179 exit(1);
180 }

--- 291 unchanged lines hidden ---