Fixes for symbolic drives
This commit is contained in:
parent
c1766dd7fe
commit
98563681c0
@ -28,6 +28,9 @@ v0.51.3 22-Mar-2003
|
|||||||
Added more debug info in Add_ToBeRep(), we still see double
|
Added more debug info in Add_ToBeRep(), we still see double
|
||||||
announces of files like FP-DEF.ZIP.
|
announces of files like FP-DEF.ZIP.
|
||||||
|
|
||||||
|
mbtask:
|
||||||
|
Fixed crash on NetBSD Sparc when getsysinfo was called.
|
||||||
|
|
||||||
mblogin:
|
mblogin:
|
||||||
Changed some defines for NetBSD 1.6.2
|
Changed some defines for NetBSD 1.6.2
|
||||||
|
|
||||||
|
@ -213,6 +213,7 @@ char *disk_getfs()
|
|||||||
|
|
||||||
if (ans != NULL)
|
if (ans != NULL)
|
||||||
free(ans);
|
free(ans);
|
||||||
|
ans = NULL;
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -256,10 +257,10 @@ void update_diskstat(void)
|
|||||||
* Add path to table.
|
* Add path to table.
|
||||||
* Find out if the parameter is a path or a file on a path.
|
* Find out if the parameter is a path or a file on a path.
|
||||||
*/
|
*/
|
||||||
void add_path(char *path)
|
void add_path(char *lpath)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char *p, *fsname, *fstype;
|
char *p, fsname[PATH_MAX], fstype[PATH_MAX], *rpath;
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
char *mtab, *fs;
|
char *mtab, *fs;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -269,7 +270,7 @@ void add_path(char *path)
|
|||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (strlen(path) == 0) {
|
if (strlen(lpath) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,20 +279,25 @@ void add_path(char *path)
|
|||||||
*/
|
*/
|
||||||
recursecount++;
|
recursecount++;
|
||||||
if (recursecount > 2) {
|
if (recursecount > 2) {
|
||||||
Syslog('!', "add_path(%s), too many recursive calls", path);
|
Syslog('!', "add_path(%s), too many recursive calls", lpath);
|
||||||
recursecount--;
|
recursecount--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lstat(path, &sb) == 0) {
|
rpath = calloc(PATH_MAX, sizeof(char));
|
||||||
|
realpath(lpath, rpath);
|
||||||
|
Syslog('d', "realpath %s", MBSE_SS(rpath));
|
||||||
|
|
||||||
|
if (lstat(rpath, &sb) == 0) {
|
||||||
|
|
||||||
|
Syslog('d', "add_path(%s)", rpath);
|
||||||
|
|
||||||
if (S_ISDIR(sb.st_mode)) {
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
|
||||||
if ((fp = fopen((char *)"/etc/mtab", "r"))) {
|
if ((fp = fopen((char *)"/etc/mtab", "r"))) {
|
||||||
mtab = calloc(PATH_MAX, sizeof(char));
|
mtab = calloc(PATH_MAX, sizeof(char));
|
||||||
fsname = calloc(PATH_MAX, sizeof(char));
|
|
||||||
fstype = calloc(PATH_MAX, sizeof(char));
|
|
||||||
fsname[0] = '\0';
|
fsname[0] = '\0';
|
||||||
|
|
||||||
while (fgets(mtab, PATH_MAX -1, fp)) {
|
while (fgets(mtab, PATH_MAX -1, fp)) {
|
||||||
@ -301,7 +307,7 @@ void add_path(char *path)
|
|||||||
* Overwrite fsname each time a match is found, the last
|
* Overwrite fsname each time a match is found, the last
|
||||||
* mounted filesystem that matches must be the one we seek.
|
* mounted filesystem that matches must be the one we seek.
|
||||||
*/
|
*/
|
||||||
if (strncmp(fs, path, strlen(fs)) == 0) {
|
if (strncmp(fs, rpath, strlen(fs)) == 0) {
|
||||||
sprintf(fsname, "%s", fs);
|
sprintf(fsname, "%s", fs);
|
||||||
fs = strtok(NULL, " \t");
|
fs = strtok(NULL, " \t");
|
||||||
sprintf(fstype, "%s", fs);
|
sprintf(fstype, "%s", fs);
|
||||||
@ -310,25 +316,19 @@ void add_path(char *path)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(mtab);
|
free(mtab);
|
||||||
fill_mfslist(&mfs, fsname, fstype);
|
fill_mfslist(&mfs, fsname, fstype);
|
||||||
free(fsname);
|
|
||||||
free(fstype);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||||
|
|
||||||
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT))) {
|
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT))) {
|
||||||
fsname = calloc(PATH_MAX, sizeof(char));
|
|
||||||
fstype = calloc(PATH_MAX, sizeof(char));
|
|
||||||
|
|
||||||
for (i = 0; i < mntsize; i++) {
|
for (i = 0; i < mntsize; i++) {
|
||||||
if (strncmp(mntbuf[i].f_mntonname, path, strlen(mntbuf[i].f_mntonname)) == 0) {
|
if (strncmp(mntbuf[i].f_mntonname, rpath, strlen(mntbuf[i].f_mntonname)) == 0) {
|
||||||
sprintf(fsname, "%s", mntbuf[i].f_mntonname);
|
sprintf(fsname, "%s", mntbuf[i].f_mntonname);
|
||||||
sprintf(fstype, "%s", mntbuf[i].f_fstypename);
|
sprintf(fstype, "%s", mntbuf[i].f_fstypename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fill_mfslist(&mfs, fsname, fstype);
|
fill_mfslist(&mfs, fsname, fstype);
|
||||||
free(fsname);
|
|
||||||
free(fstype);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -339,9 +339,9 @@ void add_path(char *path)
|
|||||||
/*
|
/*
|
||||||
* Not a directory, maybe a file.
|
* Not a directory, maybe a file.
|
||||||
*/
|
*/
|
||||||
if ((p = strrchr(path, '/')))
|
if ((p = strrchr(rpath, '/')))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
add_path(path);
|
add_path(rpath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@ -349,11 +349,12 @@ void add_path(char *path)
|
|||||||
* may not be present because this is a temporary file.
|
* may not be present because this is a temporary file.
|
||||||
* Strip the last part of the name and try again.
|
* Strip the last part of the name and try again.
|
||||||
*/
|
*/
|
||||||
if ((p = strrchr(path, '/')))
|
if ((p = strrchr(rpath, '/')))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
add_path(path);
|
add_path(rpath);
|
||||||
}
|
}
|
||||||
recursecount--;
|
recursecount--;
|
||||||
|
free(rpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -569,6 +570,10 @@ void *disk_thread(void)
|
|||||||
disk_run = FALSE;
|
disk_run = FALSE;
|
||||||
Syslog('+', "Disk thread stopped");
|
Syslog('+', "Disk thread stopped");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
|
#if defined(__NetBSD__)
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,9 +42,10 @@ char *get_sysinfo(void)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
static char buf[SS_BUFSIZE];
|
static char buf[SS_BUFSIZE];
|
||||||
char *temp;
|
char *temp;
|
||||||
|
time_t startdate;
|
||||||
|
|
||||||
sprintf(buf, "201:1,16;");
|
sprintf(buf, "201:1,16;");
|
||||||
temp = calloc(128, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(temp, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if ((fp = fopen(temp, "r")) == NULL) {
|
if ((fp = fopen(temp, "r")) == NULL) {
|
||||||
@ -53,10 +54,13 @@ char *get_sysinfo(void)
|
|||||||
}
|
}
|
||||||
free(temp);
|
free(temp);
|
||||||
|
|
||||||
if (fread(&SYSINFO, sizeof(SYSINFO), 1, fp) == 1)
|
if (fread(&SYSINFO, sizeof(SYSINFO), 1, fp) == 1) {
|
||||||
|
startdate = SYSINFO.StartDate;
|
||||||
sprintf(buf, "100:7,%ld,%ld,%ld,%ld,%ld,%s,%s;", SYSINFO.SystemCalls,
|
sprintf(buf, "100:7,%ld,%ld,%ld,%ld,%ld,%s,%s;", SYSINFO.SystemCalls,
|
||||||
SYSINFO.Pots, SYSINFO.ISDN, SYSINFO.Network, SYSINFO.Local,
|
SYSINFO.Pots, SYSINFO.ISDN, SYSINFO.Network, SYSINFO.Local,
|
||||||
ctime(&SYSINFO.StartDate), SYSINFO.LastCaller);
|
ctime(&startdate), SYSINFO.LastCaller);
|
||||||
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
Reference in New Issue
Block a user