killall.c (84768) | killall.c (93432) |
---|---|
1/*- 2 * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> 3 * Copyright (c) 2000 Paul Saab <ps@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> 3 * Copyright (c) 2000 Paul Saab <ps@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/usr.bin/killall/killall.c 84768 2001-10-10 17:48:44Z bde $ | 27 * $FreeBSD: head/usr.bin/killall/killall.c 93432 2002-03-30 16:24:03Z dwmalone $ |
28 */ 29 30#include <sys/cdefs.h> 31#include <sys/param.h> 32#include <sys/stat.h> 33#include <sys/user.h> 34#include <sys/sysctl.h> 35#include <fcntl.h> --- 184 unchanged lines hidden (view full) --- 220 if (!S_ISCHR(sb.st_mode)) 221 errx(1, "%s: not a character device", buf); 222 tdev = sb.st_rdev; 223 if (dflag) 224 printf("ttydev:0x%x\n", tdev); 225 } 226 if (user) { 227 uid = strtol(user, &ep, 10); | 28 */ 29 30#include <sys/cdefs.h> 31#include <sys/param.h> 32#include <sys/stat.h> 33#include <sys/user.h> 34#include <sys/sysctl.h> 35#include <fcntl.h> --- 184 unchanged lines hidden (view full) --- 220 if (!S_ISCHR(sb.st_mode)) 221 errx(1, "%s: not a character device", buf); 222 tdev = sb.st_rdev; 223 if (dflag) 224 printf("ttydev:0x%x\n", tdev); 225 } 226 if (user) { 227 uid = strtol(user, &ep, 10); |
228 if ((ep - user) < strlen(user)) { | 228 if (*user == '\0' || *ep != '\0') { /* was it a number? */ |
229 pw = getpwnam(user); 230 if (pw == NULL) 231 errx(1, "user %s does not exist", user); 232 uid = pw->pw_uid; 233 if (dflag) 234 printf("uid:%d\n", uid); 235 } 236 } else { --- 139 unchanged lines hidden --- | 229 pw = getpwnam(user); 230 if (pw == NULL) 231 errx(1, "user %s does not exist", user); 232 uid = pw->pw_uid; 233 if (dflag) 234 printf("uid:%d\n", uid); 235 } 236 } else { --- 139 unchanged lines hidden --- |