View | Details | Raw Unified | Return to bug 191884 | Differences between
and this patch

Collapse All | Expand All

(-)usr.sbin/chown/chown.c (-27 / +49 lines)
Lines 62-73 Link Here
62
static void	chownerr(const char *);
62
static void	chownerr(const char *);
63
static uid_t	id(const char *, const char *);
63
static uid_t	id(const char *, const char *);
64
static void	usage(void);
64
static void	usage(void);
65
static void	verbose(const FTSENT *, int);
65
66
66
static uid_t uid;
67
static uid_t uid;
67
static gid_t gid;
68
static gid_t gid;
68
static int ischown;
69
static int ischown;
69
static const char *gname;
70
static const char *gname;
71
static volatile sig_atomic_t siginfo;
70
72
73
static void
74
siginfo_handler(int sig __unused)
75
{
76
77
	siginfo = 1;
78
}
79
71
int
80
int
72
main(int argc, char **argv)
81
main(int argc, char **argv)
73
{
82
{
Lines 118-123 Link Here
118
	if (argc < 2)
127
	if (argc < 2)
119
		usage();
128
		usage();
120
129
130
	(void)signal(SIGINFO, siginfo_handler);
131
121
	if (Rflag) {
132
	if (Rflag) {
122
		fts_options = FTS_PHYSICAL;
133
		fts_options = FTS_PHYSICAL;
123
		if (hflag && (Hflag || Lflag))
134
		if (hflag && (Hflag || Lflag))
Lines 184-189 Link Here
184
		default:
195
		default:
185
			break;
196
			break;
186
		}
197
		}
198
		if (siginfo) {
199
			verbose(p, 2);
200
			siginfo = 0;
201
		}
187
		if ((uid == (uid_t)-1 || uid == p->fts_statp->st_uid) &&
202
		if ((uid == (uid_t)-1 || uid == p->fts_statp->st_uid) &&
188
		    (gid == (gid_t)-1 || gid == p->fts_statp->st_gid))
203
		    (gid == (gid_t)-1 || gid == p->fts_statp->st_gid))
189
			continue;
204
			continue;
Lines 194-226 Link Here
194
			}
209
			}
195
		} else {
210
		} else {
196
			if (vflag) {
211
			if (vflag) {
197
				printf("%s", p->fts_path);
212
				verbose(p, vflag);
198
				if (vflag > 1) {
199
					if (ischown) {
200
						printf(": %ju:%ju -> %ju:%ju",
201
						    (uintmax_t)
202
						    p->fts_statp->st_uid, 
203
						    (uintmax_t)
204
						    p->fts_statp->st_gid,
205
						    (uid == (uid_t)-1) ? 
206
						    (uintmax_t)
207
						    p->fts_statp->st_uid : 
208
						    (uintmax_t)uid,
209
						    (gid == (gid_t)-1) ? 
210
						    (uintmax_t)
211
						    p->fts_statp->st_gid :
212
						    (uintmax_t)gid);
213
					} else {
214
						printf(": %ju -> %ju",
215
						    (uintmax_t)
216
						    p->fts_statp->st_gid,
217
						    (gid == (gid_t)-1) ? 
218
						    (uintmax_t)
219
						    p->fts_statp->st_gid : 
220
						    (uintmax_t)gid);
221
					}
222
				}
223
				printf("\n");
224
			}
213
			}
225
		}
214
		}
226
	}
215
	}
Lines 313-315 Link Here
313
		    "usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
302
		    "usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
314
	exit(1);
303
	exit(1);
315
}
304
}
305
306
static void
307
verbose(const FTSENT *p, int vflag)
308
{
309
310
	printf("%s", p->fts_path);
311
	if (vflag > 1) {
312
		if (ischown) {
313
			printf(": %ju:%ju -> %ju:%ju",
314
					(uintmax_t)
315
					p->fts_statp->st_uid, 
316
					(uintmax_t)
317
					p->fts_statp->st_gid,
318
					(uid == (uid_t)-1) ? 
319
					(uintmax_t)
320
					p->fts_statp->st_uid : 
321
					(uintmax_t)uid,
322
					(gid == (gid_t)-1) ? 
323
					(uintmax_t)
324
					p->fts_statp->st_gid :
325
					(uintmax_t)gid);
326
		} else {
327
			printf(": %ju -> %ju",
328
					(uintmax_t)
329
					p->fts_statp->st_gid,
330
					(gid == (gid_t)-1) ? 
331
					(uintmax_t)
332
					p->fts_statp->st_gid : 
333
					(uintmax_t)gid);
334
		}
335
	}
336
	printf("\n");
337
}
(-)bin/chmod/chmod.c (-2 / +15 lines)
Lines 53-61 Link Here
53
#include <string.h>
53
#include <string.h>
54
#include <unistd.h>
54
#include <unistd.h>
55
55
56
static volatile sig_atomic_t siginfo;
57
56
static void usage(void);
58
static void usage(void);
57
static int may_have_nfs4acl(const FTSENT *ent, int hflag);
59
static int may_have_nfs4acl(const FTSENT *ent, int hflag);
58
60
61
static void
62
siginfo_handler(int sig __unused)
63
{
64
65
	siginfo = 1;
66
}
67
59
int
68
int
60
main(int argc, char *argv[])
69
main(int argc, char *argv[])
61
{
70
{
Lines 125-130 Link Here
125
	if (argc < 2)
134
	if (argc < 2)
126
		usage();
135
		usage();
127
136
137
	(void)signal(SIGINFO, siginfo_handler);
138
128
	if (Rflag) {
139
	if (Rflag) {
129
		fts_options = FTS_PHYSICAL;
140
		fts_options = FTS_PHYSICAL;
130
		if (hflag)
141
		if (hflag)
Lines 192-201 Link Here
192
				rval = 1;
203
				rval = 1;
193
			}
204
			}
194
		} else {
205
		} else {
195
			if (vflag) {
206
			if (vflag || siginfo) {
196
				(void)printf("%s", p->fts_path);
207
				(void)printf("%s", p->fts_path);
197
208
198
				if (vflag > 1) {
209
				if (vflag > 1 || siginfo) {
199
					char m1[12], m2[12];
210
					char m1[12], m2[12];
200
211
201
					strmode(p->fts_statp->st_mode, m1);
212
					strmode(p->fts_statp->st_mode, m1);
Lines 207-212 Link Here
207
					    newmode, m2);
218
					    newmode, m2);
208
				}
219
				}
209
				(void)printf("\n");
220
				(void)printf("\n");
221
222
				siginfo = 0;
210
			}
223
			}
211
		}
224
		}
212
	}
225
	}

Return to bug 191884