Deleted Added
full compact
futil.c (93520) futil.c (131285)
1/*
2 * FreeBSD install - a package for the installation and maintainance
3 * of non-core utilities.
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

--- 5 unchanged lines hidden (view full) ---

14 * Jordan K. Hubbard
15 * 18 July 1993
16 *
17 * Miscellaneous file access utilities.
18 *
19 */
20
21#include <sys/cdefs.h>
1/*
2 * FreeBSD install - a package for the installation and maintainance
3 * of non-core utilities.
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

--- 5 unchanged lines hidden (view full) ---

14 * Jordan K. Hubbard
15 * 18 July 1993
16 *
17 * Miscellaneous file access utilities.
18 *
19 */
20
21#include <sys/cdefs.h>
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/add/futil.c 93520 2002-04-01 09:39:07Z obrien $");
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/add/futil.c 131285 2004-06-29 19:06:42Z eik $");
23
24#include <err.h>
25#include "lib.h"
26#include "add.h"
27
28/*
29 * Assuming dir is a desired directory name, make it and all intervening
30 * directories necessary.

--- 14 unchanged lines hidden (view full) ---

45 if (fexists(dir)) {
46 if (!isdir(dir)) {
47 if (cp2)
48 *cp2 = '/';
49 return FAIL;
50 }
51 }
52 else {
23
24#include <err.h>
25#include "lib.h"
26#include "add.h"
27
28/*
29 * Assuming dir is a desired directory name, make it and all intervening
30 * directories necessary.

--- 14 unchanged lines hidden (view full) ---

45 if (fexists(dir)) {
46 if (!isdir(dir)) {
47 if (cp2)
48 *cp2 = '/';
49 return FAIL;
50 }
51 }
52 else {
53 if (vsystem("mkdir %s", dir)) {
53 if (vsystem("/bin/mkdir %s", dir)) {
54 if (cp2)
55 *cp2 = '/';
56 return FAIL;
57 }
58 apply_perms(NULL, dir);
59 }
60 /* Put it back */
61 if (cp2) {

--- 11 unchanged lines hidden (view full) ---

73 const char *cd_to;
74
75 if (!dir || *arg == '/') /* absolute path? */
76 cd_to = "/";
77 else
78 cd_to = dir;
79
80 if (Mode)
54 if (cp2)
55 *cp2 = '/';
56 return FAIL;
57 }
58 apply_perms(NULL, dir);
59 }
60 /* Put it back */
61 if (cp2) {

--- 11 unchanged lines hidden (view full) ---

73 const char *cd_to;
74
75 if (!dir || *arg == '/') /* absolute path? */
76 cd_to = "/";
77 else
78 cd_to = dir;
79
80 if (Mode)
81 if (vsystem("cd %s && chmod -R %s %s", cd_to, Mode, arg))
81 if (vsystem("cd %s && /bin/chmod -R %s %s", cd_to, Mode, arg))
82 warnx("couldn't change modes of '%s' to '%s'", arg, Mode);
83 if (Owner && Group) {
82 warnx("couldn't change modes of '%s' to '%s'", arg, Mode);
83 if (Owner && Group) {
84 if (vsystem("cd %s && chown -R %s:%s %s", cd_to, Owner, Group, arg))
84 if (vsystem("cd %s && /usr/sbin/chown -R %s:%s %s", cd_to, Owner, Group, arg))
85 warnx("couldn't change owner/group of '%s' to '%s:%s'",
86 arg, Owner, Group);
87 return;
88 }
89 if (Owner) {
85 warnx("couldn't change owner/group of '%s' to '%s:%s'",
86 arg, Owner, Group);
87 return;
88 }
89 if (Owner) {
90 if (vsystem("cd %s && chown -R %s %s", cd_to, Owner, arg))
90 if (vsystem("cd %s && /usr/sbin/chown -R %s %s", cd_to, Owner, arg))
91 warnx("couldn't change owner of '%s' to '%s'", arg, Owner);
92 return;
93 } else if (Group)
91 warnx("couldn't change owner of '%s' to '%s'", arg, Owner);
92 return;
93 } else if (Group)
94 if (vsystem("cd %s && chgrp -R %s %s", cd_to, Group, arg))
94 if (vsystem("cd %s && /usr/bin/chgrp -R %s %s", cd_to, Group, arg))
95 warnx("couldn't change group of '%s' to '%s'", arg, Group);
96}
97
95 warnx("couldn't change group of '%s' to '%s'", arg, Group);
96}
97