mksnap_ffs.c (121706) | mksnap_ffs.c (121707) |
---|---|
1/* 2 * Copyright (c) 2003 Networks Associates Technology, Inc. 3 * All rights reserved. 4 * 5 * This software was developed for the FreeBSD Project by Marshall 6 * Kirk McKusick and Network Associates Laboratories, the Security 7 * Research Division of Network Associates, Inc. under DARPA/SPAWAR 8 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * | 1/* 2 * Copyright (c) 2003 Networks Associates Technology, Inc. 3 * All rights reserved. 4 * 5 * This software was developed for the FreeBSD Project by Marshall 6 * Kirk McKusick and Network Associates Laboratories, the Security 7 * Research Division of Network Associates, Inc. under DARPA/SPAWAR 8 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sbin/mksnap_ffs/mksnap_ffs.c 121706 2003-10-29 21:21:09Z trhodes $ | 35 * $FreeBSD: head/sbin/mksnap_ffs/mksnap_ffs.c 121707 2003-10-29 21:23:44Z trhodes $ |
36 */ 37 38#include <sys/param.h> 39#include <sys/mount.h> 40#include <sys/stat.h> 41#include <ufs/ufs/ufsmount.h> 42#include <err.h> 43#include <errno.h> 44#include <fcntl.h> 45#include <grp.h> 46#include <stdio.h> 47#include <stdlib.h> 48#include <string.h> 49#include <sysexits.h> 50#include <unistd.h> 51 52void usage(void); 53 | 36 */ 37 38#include <sys/param.h> 39#include <sys/mount.h> 40#include <sys/stat.h> 41#include <ufs/ufs/ufsmount.h> 42#include <err.h> 43#include <errno.h> 44#include <fcntl.h> 45#include <grp.h> 46#include <stdio.h> 47#include <stdlib.h> 48#include <string.h> 49#include <sysexits.h> 50#include <unistd.h> 51 52void usage(void); 53 |
54void 55usage() 56{ 57 58 fprintf(stderr, "usage: mksnap_ffs mountpoint snapshot_name\n"); 59 exit(EX_USAGE); 60} 61 | |
62int 63main(int argc, char **argv) 64{ 65 const char *dir; 66 struct ufs_args args; 67 struct group *grp; 68 struct stat stbuf; 69 int fd; --- 16 unchanged lines hidden (view full) --- 86 errx(1, "File %s is not a snapshot", args.fspec); 87 if (fchown(fd, -1, grp->gr_gid) != 0) 88 err(1, "Cannot chown %s", args.fspec); 89 if (fchmod(fd, S_IRUSR | S_IRGRP) != 0) 90 err(1, "Cannot chmod %s", args.fspec); 91 92 exit(EXIT_SUCCESS); 93} | 54int 55main(int argc, char **argv) 56{ 57 const char *dir; 58 struct ufs_args args; 59 struct group *grp; 60 struct stat stbuf; 61 int fd; --- 16 unchanged lines hidden (view full) --- 78 errx(1, "File %s is not a snapshot", args.fspec); 79 if (fchown(fd, -1, grp->gr_gid) != 0) 80 err(1, "Cannot chown %s", args.fspec); 81 if (fchmod(fd, S_IRUSR | S_IRGRP) != 0) 82 err(1, "Cannot chmod %s", args.fspec); 83 84 exit(EXIT_SUCCESS); 85} |
86 87void 88usage() 89{ 90 91 fprintf(stderr, "usage: mksnap_ffs mountpoint snapshot_name\n"); 92 exit(EX_USAGE); 93} |
|