When a filearea was moved to another path the symlinks were forgotten
This commit is contained in:
parent
fcdbbbbd6d
commit
89c7bfe8db
@ -35,6 +35,10 @@ v0.83.13 13-Feb-2006
|
|||||||
Fixed startup problem on new installations.
|
Fixed startup problem on new installations.
|
||||||
Some code cleanup.
|
Some code cleanup.
|
||||||
|
|
||||||
|
mbsetup:
|
||||||
|
When a filearea was moved to another path the symlinks were not
|
||||||
|
moved to the new path.
|
||||||
|
|
||||||
|
|
||||||
v0.83.12 06-Feb-2006 - 13-Feb-2006
|
v0.83.12 06-Feb-2006 - 13-Feb-2006
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: File Setup Program
|
* Purpose ...............: File Setup Program
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2005
|
* Copyright (C) 1997-2006
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -262,14 +262,14 @@ void FileScreen(void)
|
|||||||
int EditFileRec(int Area)
|
int EditFileRec(int Area)
|
||||||
{
|
{
|
||||||
FILE *fil;
|
FILE *fil;
|
||||||
char mfile[PATH_MAX], *temp, tpath[65], frpath[81], topath[81];
|
char mfile[PATH_MAX], *temp, tpath[65], frpath[PATH_MAX], topath[PATH_MAX], *lnpath;
|
||||||
int offset;
|
|
||||||
unsigned int crc, crc1;
|
unsigned int crc, crc1;
|
||||||
int Available, files, rc, Force = FALSE, count;
|
int Available, files, rc, Force = FALSE, count, offset;
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
struct stat stb;
|
struct stat stb;
|
||||||
struct _fdbarea *fdb_area = NULL;
|
struct _fdbarea *fdb_area = NULL;
|
||||||
|
struct FILE_record f_db;
|
||||||
|
|
||||||
clr_index();
|
clr_index();
|
||||||
working(1, 0, 0);
|
working(1, 0, 0);
|
||||||
@ -352,11 +352,15 @@ int EditFileRec(int Area)
|
|||||||
working(5, 0, 0);
|
working(5, 0, 0);
|
||||||
count = 0;
|
count = 0;
|
||||||
Syslog('+', "Moving files from %s to %s", tpath, area.Path);
|
Syslog('+', "Moving files from %s to %s", tpath, area.Path);
|
||||||
|
lnpath = calloc(PATH_MAX, sizeof(char));
|
||||||
while ((de = readdir(dp))) {
|
while ((de = readdir(dp))) {
|
||||||
snprintf(frpath, 81, "%s/%s", tpath, de->d_name);
|
snprintf(frpath, PATH_MAX, "%s/%s", tpath, de->d_name);
|
||||||
snprintf(topath, 81, "%s/%s", area.Path, de->d_name);
|
snprintf(topath, PATH_MAX, "%s/%s", area.Path, de->d_name);
|
||||||
if (stat(frpath, &stb) == 0) {
|
if (lstat(frpath, &stb) == 0) {
|
||||||
if (S_ISREG(stb.st_mode)) {
|
if (S_ISREG(stb.st_mode)) {
|
||||||
|
/*
|
||||||
|
* The real files, also files.bbs, index.html etc.
|
||||||
|
*/
|
||||||
rc = file_mv(frpath, topath);
|
rc = file_mv(frpath, topath);
|
||||||
if (rc)
|
if (rc)
|
||||||
WriteError("mv %s to %s rc=%d", frpath, topath, rc);
|
WriteError("mv %s to %s rc=%d", frpath, topath, rc);
|
||||||
@ -364,9 +368,31 @@ int EditFileRec(int Area)
|
|||||||
count++;
|
count++;
|
||||||
Nopper();
|
Nopper();
|
||||||
}
|
}
|
||||||
|
if (S_ISLNK(stb.st_mode)) {
|
||||||
|
/*
|
||||||
|
* The linked LFN
|
||||||
|
*/
|
||||||
|
if ((fdb_area = mbsedb_OpenFDB(Area, 30))) {
|
||||||
|
while (fread(&f_db, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
|
||||||
|
if (strcmp(f_db.LName, de->d_name) == 0) {
|
||||||
|
/*
|
||||||
|
* Got the symlink to the LFN
|
||||||
|
*/
|
||||||
|
unlink(frpath);
|
||||||
|
snprintf(lnpath, PATH_MAX, "%s/%s", area.Path, f_db.Name);
|
||||||
|
if (symlink(lnpath, topath)) {
|
||||||
|
WriteError("$symlink(%s, %s)", lnpath, topath);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mbsedb_CloseFDB(fdb_area);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dp);
|
closedir(dp);
|
||||||
|
free(lnpath);
|
||||||
if ((rc = rmdir(tpath)))
|
if ((rc = rmdir(tpath)))
|
||||||
WriteError("rmdir %s rc=%d", tpath, rc);
|
WriteError("rmdir %s rc=%d", tpath, rc);
|
||||||
Force = TRUE;
|
Force = TRUE;
|
||||||
@ -429,13 +455,8 @@ int EditFileRec(int Area)
|
|||||||
}
|
}
|
||||||
if (!area.Available && Available) {
|
if (!area.Available && Available) {
|
||||||
area.Available = TRUE;
|
area.Available = TRUE;
|
||||||
Syslog('-', "open");
|
|
||||||
if ((fdb_area = mbsedb_OpenFDB(Area, 30))) {
|
if ((fdb_area = mbsedb_OpenFDB(Area, 30))) {
|
||||||
Syslog('-', "is open");
|
|
||||||
mbsedb_CloseFDB(fdb_area);
|
mbsedb_CloseFDB(fdb_area);
|
||||||
Syslog('-', "closed");
|
|
||||||
} else {
|
|
||||||
Syslog('-', "failed to open");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(temp);
|
free(temp);
|
||||||
|
Reference in New Issue
Block a user