startdaemon.c (216372) | startdaemon.c (241852) |
---|---|
1/* 2 * Copyright (c) 1983, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 29 30#if 0 31#ifndef lint 32static char sccsid[] = "@(#)startdaemon.c 8.2 (Berkeley) 4/17/94"; 33#endif /* not lint */ 34#endif 35 36#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */ | 1/* 2 * Copyright (c) 1983, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 29 30#if 0 31#ifndef lint 32static char sccsid[] = "@(#)startdaemon.c 8.2 (Berkeley) 4/17/94"; 33#endif /* not lint */ 34#endif 35 36#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */ |
37__FBSDID("$FreeBSD: head/usr.sbin/lpr/common_source/startdaemon.c 216372 2010-12-11 09:38:12Z joel $"); | 37__FBSDID("$FreeBSD: head/usr.sbin/lpr/common_source/startdaemon.c 241852 2012-10-22 03:31:22Z eadler $"); |
38 39#include <sys/param.h> 40#include <sys/socket.h> 41#include <sys/uio.h> 42#include <sys/un.h> 43 44#include <dirent.h> 45#include <err.h> --- 23 unchanged lines hidden (view full) --- 69 return(0); 70 } 71 memset(&un, 0, sizeof(un)); 72 un.sun_family = AF_LOCAL; 73 strcpy(un.sun_path, _PATH_SOCKETNAME); 74#ifndef SUN_LEN 75#define SUN_LEN(unp) (strlen((unp)->sun_path) + 2) 76#endif | 38 39#include <sys/param.h> 40#include <sys/socket.h> 41#include <sys/uio.h> 42#include <sys/un.h> 43 44#include <dirent.h> 45#include <err.h> --- 23 unchanged lines hidden (view full) --- 69 return(0); 70 } 71 memset(&un, 0, sizeof(un)); 72 un.sun_family = AF_LOCAL; 73 strcpy(un.sun_path, _PATH_SOCKETNAME); 74#ifndef SUN_LEN 75#define SUN_LEN(unp) (strlen((unp)->sun_path) + 2) 76#endif |
77 seteuid(euid); | 77 PRIV_START |
78 connectres = connect(s, (struct sockaddr *)&un, SUN_LEN(&un)); | 78 connectres = connect(s, (struct sockaddr *)&un, SUN_LEN(&un)); |
79 seteuid(uid); | 79 PRIV_END |
80 if (connectres < 0) { 81 warn("Unable to connect to %s", _PATH_SOCKETNAME); 82 warnx("Check to see if the master 'lpd' process is running."); 83 (void) close(s); 84 return(0); 85 } 86 87 /* --- 20 unchanged lines hidden --- | 80 if (connectres < 0) { 81 warn("Unable to connect to %s", _PATH_SOCKETNAME); 82 warnx("Check to see if the master 'lpd' process is running."); 83 (void) close(s); 84 return(0); 85 } 86 87 /* --- 20 unchanged lines hidden --- |