Deleted Added
full compact
login_fbtab.c (92920) login_fbtab.c (169342)
1/************************************************************************
2* Copyright 1995 by Wietse Venema. All rights reserved.
3*
4* This material was originally written and compiled by Wietse Venema at
5* Eindhoven University of Technology, The Netherlands, in 1990, 1991,
6* 1992, 1993, 1994 and 1995.
7*
8* Redistribution and use in source and binary forms are permitted

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

54
55 AUTHOR
56 Wietse Venema (wietse@wzv.win.tue.nl)
57 Eindhoven University of Technology
58 The Netherlands
59 */
60
61#include <sys/cdefs.h>
1/************************************************************************
2* Copyright 1995 by Wietse Venema. All rights reserved.
3*
4* This material was originally written and compiled by Wietse Venema at
5* Eindhoven University of Technology, The Netherlands, in 1990, 1991,
6* 1992, 1993, 1994 and 1995.
7*
8* Redistribution and use in source and binary forms are permitted

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

54
55 AUTHOR
56 Wietse Venema (wietse@wzv.win.tue.nl)
57 Eindhoven University of Technology
58 The Netherlands
59 */
60
61#include <sys/cdefs.h>
62__FBSDID("$FreeBSD: head/usr.bin/login/login_fbtab.c 92920 2002-03-22 01:22:50Z imp $");
62__FBSDID("$FreeBSD: head/usr.bin/login/login_fbtab.c 169342 2007-05-07 11:01:36Z dwmalone $");
63
64#include <sys/types.h>
65#include <sys/stat.h>
66#include <errno.h>
67#include <glob.h>
68#include <paths.h>
69#include <stdio.h>
70#include <string.h>

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

128const char *table;
129char *pattern;
130int mask;
131uid_t uid;
132gid_t gid;
133{
134 glob_t gl;
135 char *path;
63
64#include <sys/types.h>
65#include <sys/stat.h>
66#include <errno.h>
67#include <glob.h>
68#include <paths.h>
69#include <stdio.h>
70#include <string.h>

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

128const char *table;
129char *pattern;
130int mask;
131uid_t uid;
132gid_t gid;
133{
134 glob_t gl;
135 char *path;
136 int i;
136 unsigned int i;
137
138 if (glob(pattern, GLOB_NOSORT, NULL, &gl) != 0)
139 return;
140 for (i = 0; i < gl.gl_pathc; i++) {
141 path = gl.gl_pathv[i];
142 /* clear flags of the device */
143 if (chflags(path, 0) && errno != ENOENT && errno != EOPNOTSUPP)
144 syslog(LOG_ERR, "%s: chflags(%s): %m", table, path);
145 if (chmod(path, mask) && errno != ENOENT)
146 syslog(LOG_ERR, "%s: chmod(%s): %m", table, path);
147 if (chown(path, uid, gid) && errno != ENOENT)
148 syslog(LOG_ERR, "%s: chown(%s): %m", table, path);
149 }
150 globfree(&gl);
151}
137
138 if (glob(pattern, GLOB_NOSORT, NULL, &gl) != 0)
139 return;
140 for (i = 0; i < gl.gl_pathc; i++) {
141 path = gl.gl_pathv[i];
142 /* clear flags of the device */
143 if (chflags(path, 0) && errno != ENOENT && errno != EOPNOTSUPP)
144 syslog(LOG_ERR, "%s: chflags(%s): %m", table, path);
145 if (chmod(path, mask) && errno != ENOENT)
146 syslog(LOG_ERR, "%s: chmod(%s): %m", table, path);
147 if (chown(path, uid, gid) && errno != ENOENT)
148 syslog(LOG_ERR, "%s: chown(%s): %m", table, path);
149 }
150 globfree(&gl);
151}