install.bin.c (c0e7977a434048a8bc7386ea0e8befaa77a646cf) | install.bin.c (93b8872871607b3d21317283c1230b2a4a00920b) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 8 unchanged lines hidden (view full) --- 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 23 */ 24 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 8 unchanged lines hidden (view full) --- 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 23 */ 24 |
25/* 26 * Copyright (c) 2018, Joyent, Inc. 27 */ |
|
25 26#include <stdio.h> 27#include <stdlib.h> 28#include <strings.h> 29#include <sys/param.h> 30#include <fcntl.h> 31#include <sys/errno.h> 32#include <sys/types.h> --- 65 unchanged lines hidden (view full) --- 98void 99chown_file(const char *file, const char *group, const char *owner) 100{ 101 gid_t grp = (gid_t)-1; 102 uid_t own = (uid_t)-1; 103 104 if (group) { 105 grp = stdfind(group, groupnames); | 28 29#include <stdio.h> 30#include <stdlib.h> 31#include <strings.h> 32#include <sys/param.h> 33#include <fcntl.h> 34#include <sys/errno.h> 35#include <sys/types.h> --- 65 unchanged lines hidden (view full) --- 101void 102chown_file(const char *file, const char *group, const char *owner) 103{ 104 gid_t grp = (gid_t)-1; 105 uid_t own = (uid_t)-1; 106 107 if (group) { 108 grp = stdfind(group, groupnames); |
106 if (grp < 0) | 109 if (grp == (gid_t)-1) |
107 (void) fprintf(stderr, "unknown group(%s)\n", group); 108 } 109 110 if (owner) { 111 own = stdfind(owner, usernames); | 110 (void) fprintf(stderr, "unknown group(%s)\n", group); 111 } 112 113 if (owner) { 114 own = stdfind(owner, usernames); |
112 if (own < 0) { | 115 if (own == (uid_t)-1) { |
113 (void) fprintf(stderr, "unknown owner(%s)\n", owner); 114 exit(1); 115 } 116 117 } 118 119 if (chown(file, own, grp) == -1) { 120 (void) fprintf(stderr, "install:chown_file: failed " --- 126 unchanged lines hidden --- | 116 (void) fprintf(stderr, "unknown owner(%s)\n", owner); 117 exit(1); 118 } 119 120 } 121 122 if (chown(file, own, grp) == -1) { 123 (void) fprintf(stderr, "install:chown_file: failed " --- 126 unchanged lines hidden --- |