fsinfo.c (131706) | fsinfo.c (174313) |
---|---|
1/* | 1/* |
2 * Copyright (c) 1997-2004 Erez Zadok | 2 * Copyright (c) 1997-2006 Erez Zadok |
3 * Copyright (c) 1989 Jan-Simon Pendry 4 * Copyright (c) 1989 Imperial College of Science, Technology & Medicine 5 * Copyright (c) 1989 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Jan-Simon Pendry at Imperial College, London. 10 * --- 21 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * | 3 * Copyright (c) 1989 Jan-Simon Pendry 4 * Copyright (c) 1989 Imperial College of Science, Technology & Medicine 5 * Copyright (c) 1989 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Jan-Simon Pendry at Imperial College, London. 10 * --- 21 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * |
40 * $Id: fsinfo.c,v 1.5.2.7 2004/05/12 15:54:31 ezk Exp $ 41 * $FreeBSD: head/contrib/amd/fsinfo/fsinfo.c 131706 2004-07-06 13:16:49Z mbr $ | 40 * File: am-utils/fsinfo/fsinfo.c |
42 * 43 */ 44 45/* 46 * fsinfo 47 */ 48 49#ifdef HAVE_CONFIG_H --- 70 unchanged lines hidden (view full) --- 120 121 case 'd': 122 if (dumpset_pref) 123 fatal("-d option specified twice"); 124 dumpset_pref = optarg; 125 break; 126 127 case 'h': | 41 * 42 */ 43 44/* 45 * fsinfo 46 */ 47 48#ifdef HAVE_CONFIG_H --- 70 unchanged lines hidden (view full) --- 119 120 case 'd': 121 if (dumpset_pref) 122 fatal("-d option specified twice"); 123 dumpset_pref = optarg; 124 break; 125 126 case 'h': |
128 strncpy(hostname, optarg, sizeof(hostname) - 1); | 127 xstrlcpy(hostname, optarg, sizeof(hostname)); |
129 break; 130 131 case 'e': 132 if (exportfs_pref) 133 fatal("-e option specified twice"); 134 exportfs_pref = optarg; 135 break; 136 --- 15 unchanged lines hidden (view full) --- 152 153 case 'v': 154 verbose = 1; 155 break; 156 157 case 'I': 158 case 'D': 159 case 'U': | 128 break; 129 130 case 'e': 131 if (exportfs_pref) 132 fatal("-e option specified twice"); 133 exportfs_pref = optarg; 134 break; 135 --- 15 unchanged lines hidden (view full) --- 151 152 case 'v': 153 verbose = 1; 154 break; 155 156 case 'I': 157 case 'D': 158 case 'U': |
160 sprintf(iptr, "-%c%s ", ch, optarg); | 159 /* sizeof(iptr) is actually that of idvbuf. See declaration above */ 160 xsnprintf(iptr, sizeof(idvbuf), "-%c%s ", ch, optarg); |
161 iptr += strlen(iptr); 162 break; 163 164 default: 165 usage++; 166 break; 167 } 168 --- 24 unchanged lines hidden (view full) --- 193 194 195/* 196 * Determine username of caller 197 */ 198static char * 199find_username(void) 200{ | 161 iptr += strlen(iptr); 162 break; 163 164 default: 165 usage++; 166 break; 167 } 168 --- 24 unchanged lines hidden (view full) --- 193 194 195/* 196 * Determine username of caller 197 */ 198static char * 199find_username(void) 200{ |
201 char *u = getlogin(); | 201 const char *u = getlogin(); |
202 203 if (!u) { 204 struct passwd *pw = getpwuid(getuid()); 205 if (pw) 206 u = pw->pw_name; 207 } 208 209 if (!u) --- 20 unchanged lines hidden (view full) --- 230 231 /* 232 * If no hostname given then use the local name 233 */ 234 if (!*hostname && gethostname(hostname, sizeof(hostname)) < 0) { 235 perror("gethostname"); 236 exit(1); 237 } | 202 203 if (!u) { 204 struct passwd *pw = getpwuid(getuid()); 205 if (pw) 206 u = pw->pw_name; 207 } 208 209 if (!u) --- 20 unchanged lines hidden (view full) --- 230 231 /* 232 * If no hostname given then use the local name 233 */ 234 if (!*hostname && gethostname(hostname, sizeof(hostname)) < 0) { 235 perror("gethostname"); 236 exit(1); 237 } |
238 hostname[sizeof(hostname) - 1] = '\0'; |
|
238 239 /* 240 * Get the username 241 */ 242 username = find_username(); 243 244 /* 245 * New hosts and automounts --- 45 unchanged lines hidden --- | 239 240 /* 241 * Get the username 242 */ 243 username = find_username(); 244 245 /* 246 * New hosts and automounts --- 45 unchanged lines hidden --- |