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.
|
||||
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
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: File Setup Program
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2005
|
||||
* Copyright (C) 1997-2006
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -262,14 +262,14 @@ void FileScreen(void)
|
||||
int EditFileRec(int Area)
|
||||
{
|
||||
FILE *fil;
|
||||
char mfile[PATH_MAX], *temp, tpath[65], frpath[81], topath[81];
|
||||
int offset;
|
||||
char mfile[PATH_MAX], *temp, tpath[65], frpath[PATH_MAX], topath[PATH_MAX], *lnpath;
|
||||
unsigned int crc, crc1;
|
||||
int Available, files, rc, Force = FALSE, count;
|
||||
int Available, files, rc, Force = FALSE, count, offset;
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
struct stat stb;
|
||||
struct _fdbarea *fdb_area = NULL;
|
||||
struct FILE_record f_db;
|
||||
|
||||
clr_index();
|
||||
working(1, 0, 0);
|
||||
@ -352,11 +352,15 @@ int EditFileRec(int Area)
|
||||
working(5, 0, 0);
|
||||
count = 0;
|
||||
Syslog('+', "Moving files from %s to %s", tpath, area.Path);
|
||||
lnpath = calloc(PATH_MAX, sizeof(char));
|
||||
while ((de = readdir(dp))) {
|
||||
snprintf(frpath, 81, "%s/%s", tpath, de->d_name);
|
||||
snprintf(topath, 81, "%s/%s", area.Path, de->d_name);
|
||||
if (stat(frpath, &stb) == 0) {
|
||||
snprintf(frpath, PATH_MAX, "%s/%s", tpath, de->d_name);
|
||||
snprintf(topath, PATH_MAX, "%s/%s", area.Path, de->d_name);
|
||||
if (lstat(frpath, &stb) == 0) {
|
||||
if (S_ISREG(stb.st_mode)) {
|
||||
/*
|
||||
* The real files, also files.bbs, index.html etc.
|
||||
*/
|
||||
rc = file_mv(frpath, topath);
|
||||
if (rc)
|
||||
WriteError("mv %s to %s rc=%d", frpath, topath, rc);
|
||||
@ -364,9 +368,31 @@ int EditFileRec(int Area)
|
||||
count++;
|
||||
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);
|
||||
free(lnpath);
|
||||
if ((rc = rmdir(tpath)))
|
||||
WriteError("rmdir %s rc=%d", tpath, rc);
|
||||
Force = TRUE;
|
||||
@ -429,13 +455,8 @@ int EditFileRec(int Area)
|
||||
}
|
||||
if (!area.Available && Available) {
|
||||
area.Available = TRUE;
|
||||
Syslog('-', "open");
|
||||
if ((fdb_area = mbsedb_OpenFDB(Area, 30))) {
|
||||
Syslog('-', "is open");
|
||||
mbsedb_CloseFDB(fdb_area);
|
||||
Syslog('-', "closed");
|
||||
} else {
|
||||
Syslog('-', "failed to open");
|
||||
}
|
||||
}
|
||||
free(temp);
|
||||
|
Reference in New Issue
Block a user