preen.c (55275) | preen.c (66861) |
---|---|
1/* 2 * Copyright (c) 1990, 1993 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 --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; 37#endif 38static const char rcsid[] = | 1/* 2 * Copyright (c) 1990, 1993 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 --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; 37#endif 38static const char rcsid[] = |
39 "$FreeBSD: head/sbin/quotacheck/preen.c 55275 1999-12-30 16:32:40Z peter $"; | 39 "$FreeBSD: head/sbin/quotacheck/preen.c 66861 2000-10-09 08:26:35Z adrian $"; |
40#endif /* not lint */ 41 42#include <sys/param.h> 43#include <sys/stat.h> 44#include <sys/wait.h> 45 46#include <ufs/ufs/dinode.h> 47 --- 235 unchanged lines hidden (view full) --- 283 return (8); 284 } 285 if (dk->pid == 0) 286 exit((*checkit)(pt->name, pt->fsname, pt->auxdata, 1)); 287 nrun++; 288 return (0); 289} 290 | 40#endif /* not lint */ 41 42#include <sys/param.h> 43#include <sys/stat.h> 44#include <sys/wait.h> 45 46#include <ufs/ufs/dinode.h> 47 --- 235 unchanged lines hidden (view full) --- 283 return (8); 284 } 285 if (dk->pid == 0) 286 exit((*checkit)(pt->name, pt->fsname, pt->auxdata, 1)); 287 nrun++; 288 return (0); 289} 290 |
291char * 292blockcheck(origname) 293 char *origname; 294{ 295 struct stat stslash, stblock, stchar; 296 char *newname, *raw; 297 struct fstab *fsinfo; 298 int retried = 0, len; 299 300 newname = origname; 301retry: 302 if (stat(newname, &stblock) < 0) { 303 printf("Can't stat %s: %s\n", newname, strerror(errno)); 304 return (origname); 305 } 306 switch(stblock.st_mode & S_IFMT) { 307 case S_IFCHR: 308 case S_IFBLK: 309 return(newname); 310 case S_IFDIR: 311 if (retried) 312 break; 313 314 len = strlen(origname) - 1; 315 if (len > 0 && origname[len] == '/') 316 /* remove trailing slash */ 317 origname[len] = '\0'; 318 if ((fsinfo = getfsfile(origname)) == NULL) { 319 printf("Can't resolve %s to character special device", 320 origname); 321 return (0); 322 } 323 newname = fsinfo->fs_spec; 324 retried++; 325 goto retry; 326 } 327 /* 328 * Not a block or character device, just return name and 329 * let the user decide whether to use it. 330 */ 331 return (origname); 332} | |