remove empty blanks from empty lines

This commit is contained in:
Werner Fink 2010-03-19 14:09:15 +00:00
parent b98dd2505c
commit 94a203f9e1
2 changed files with 27 additions and 27 deletions

View File

@ -245,14 +245,14 @@ void init_nfs(void)
struct stat st; struct stat st;
struct mntent * ent; struct mntent * ent;
FILE * mnt; FILE * mnt;
nlist = (NFS*)0; nlist = (NFS*)0;
if (stat("/proc/version", &st) < 0) if (stat("/proc/version", &st) < 0)
return; return;
if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0) if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0)
return; return;
while ((ent = getmntent(mnt))) { while ((ent = getmntent(mnt))) {
if (isnetfs(ent->mnt_type)) { if (isnetfs(ent->mnt_type)) {
size_t nlen = strlen(ent->mnt_dir); size_t nlen = strlen(ent->mnt_dir);
@ -261,7 +261,7 @@ void init_nfs(void)
p->name = ((char*)p)+alignof(NFS); p->name = ((char*)p)+alignof(NFS);
p->nlen = nlen; p->nlen = nlen;
p->shadow = (SHADOW*)0; p->shadow = (SHADOW*)0;
strcpy(p->name, ent->mnt_dir); strcpy(p->name, ent->mnt_dir);
if (nlist) if (nlist)
nlist->prev = p; nlist->prev = p;
@ -271,27 +271,27 @@ void init_nfs(void)
} }
} }
endmntent(mnt); endmntent(mnt);
if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0) if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0)
return; return;
while ((ent = getmntent(mnt))) { while ((ent = getmntent(mnt))) {
NFS *p; NFS *p;
for (p = nlist; p; p = p->next) { for (p = nlist; p; p = p->next) {
SHADOW * restrict s; SHADOW * restrict s;
size_t nlen; size_t nlen;
if (strcmp(ent->mnt_dir, p->name) == 0) if (strcmp(ent->mnt_dir, p->name) == 0)
continue; continue;
if (strncmp(ent->mnt_dir, p->name, p->nlen) != 0) if (strncmp(ent->mnt_dir, p->name, p->nlen) != 0)
continue; continue;
nlen = strlen(ent->mnt_dir); nlen = strlen(ent->mnt_dir);
xmemalign((void*)&s, sizeof(void*), alignof(SHADOW)+(nlen+1)); xmemalign((void*)&s, sizeof(void*), alignof(SHADOW)+(nlen+1));
s->name = ((char*)s)+alignof(SHADOW); s->name = ((char*)s)+alignof(SHADOW);
s->nlen = nlen; s->nlen = nlen;
strcpy(s->name, ent->mnt_dir); strcpy(s->name, ent->mnt_dir);
if (p->shadow) if (p->shadow)
p->shadow->prev = s; p->shadow->prev = s;
@ -306,7 +306,7 @@ void init_nfs(void)
static void clear_shadow(SHADOW *restrict shadow) static void clear_shadow(SHADOW *restrict shadow)
{ {
SHADOW *s, *n, *l; SHADOW *s, *n, *l;
n = shadow; n = shadow;
l = (SHADOW*)0; l = (SHADOW*)0;
for (s = shadow; n; s = n) { for (s = shadow; n; s = n) {
@ -326,7 +326,7 @@ static void clear_shadow(SHADOW *restrict shadow)
static void clear_mnt(void) static void clear_mnt(void)
{ {
NFS *p, *n, *l; NFS *p, *n, *l;
n = nlist; n = nlist;
l = (NFS*)0; l = (NFS*)0;
for (p = nlist; n; p = n) { for (p = nlist; n; p = n) {
@ -351,7 +351,7 @@ static void clear_mnt(void)
static int shadow(SHADOW *restrict this, const char *restrict name, const size_t nlen) static int shadow(SHADOW *restrict this, const char *restrict name, const size_t nlen)
{ {
SHADOW *s; SHADOW *s;
if (!this) if (!this)
goto out; goto out;
for (s = this; s; s = s->next) { for (s = this; s; s = s->next) {
@ -374,45 +374,45 @@ int check4nfs(const char * path, char * real)
char buf[PATH_MAX+1]; char buf[PATH_MAX+1];
const char *curr; const char *curr;
int deep = MAXSYMLINKS; int deep = MAXSYMLINKS;
if (!nlist) return 0; if (!nlist) return 0;
curr = path; curr = path;
do { do {
const char *prev; const char *prev;
int len; int len;
if ((prev = strdupa(curr)) == NULL) { if ((prev = strdupa(curr)) == NULL) {
nsyslog(LOG_ERR, "strdupa(): %s\n", strerror(errno)); nsyslog(LOG_ERR, "strdupa(): %s\n", strerror(errno));
return 0; return 0;
} }
errno = 0; errno = 0;
if ((len = readlink(curr, buf, PATH_MAX)) < 0) if ((len = readlink(curr, buf, PATH_MAX)) < 0)
break; break;
buf[len] = '\0'; buf[len] = '\0';
if (buf[0] != '/') { if (buf[0] != '/') {
const char *slash; const char *slash;
if ((slash = strrchr(prev, '/'))) { if ((slash = strrchr(prev, '/'))) {
size_t off = slash - prev + 1; size_t off = slash - prev + 1;
if (off + len > PATH_MAX) if (off + len > PATH_MAX)
len = PATH_MAX - off; len = PATH_MAX - off;
memmove(&buf[off], &buf[0], len + 1); memmove(&buf[off], &buf[0], len + 1);
memcpy(&buf[0], prev, off); memcpy(&buf[0], prev, off);
} }
} }
curr = &buf[0]; curr = &buf[0];
if (deep-- <= 0) return 0; if (deep-- <= 0) return 0;
} while (1); } while (1);
if (real) strcpy(real, curr); if (real) strcpy(real, curr);
if (errno == EINVAL) { if (errno == EINVAL) {
const size_t nlen = strlen(curr); const size_t nlen = strlen(curr);
NFS *p; NFS *p;
@ -428,7 +428,7 @@ int check4nfs(const char * path, char * real)
} }
} }
} }
return 0; return 0;
} }

View File

@ -134,7 +134,7 @@ void fixtty(void)
tty.c_cc[VWERASE] = CWERASE; tty.c_cc[VWERASE] = CWERASE;
tty.c_cc[VLNEXT] = CLNEXT; tty.c_cc[VLNEXT] = CLNEXT;
tty.c_cc[VEOL2] = _POSIX_VDISABLE; tty.c_cc[VEOL2] = _POSIX_VDISABLE;
tcsetattr(0, TCSANOW, &tty); tcsetattr(0, TCSANOW, &tty);
out: out:
return; return;