mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Sat Jan 9 19:15:00 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* vfs/vfs.c (vfs_timeout_handler): Guard from recursive invocation. Sat Jan 9 19:13:28 1999 Norbert Warmuth <nwarmuth@privat.circular.de> * vfs/sfs.c (sfs_free): Fixed wrong linked list handling (head was lost after the first iteration). (sfs_getid): dito, return value was wrong.
This commit is contained in:
parent
23155b3f8b
commit
749d16ba30
@ -1,3 +1,14 @@
|
||||
Sat Jan 9 19:15:00 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* vfs.c (vfs_timeout_handler): Guard from recursive invocation.
|
||||
|
||||
Sat Jan 9 19:13:28 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* sfs.c (sfs_free): Fixed wrong linked list handling (head was
|
||||
lost after the first iteration).
|
||||
|
||||
(sfs_getid): dito, return value was wrong.
|
||||
|
||||
Sat Jan 9 22:49:02 1999 Timur I. Bakeyev <timur@com.bat.ru>
|
||||
|
||||
* vfs.c (parse_ls_lga): Rewrite function to make it more stright.
|
||||
|
33
vfs/sfs.c
33
vfs/sfs.c
@ -201,21 +201,20 @@ static int sfs_readlink (vfs *me, char *path, char *buf, int size)
|
||||
return readlink (path, buf, size);
|
||||
}
|
||||
|
||||
#define CUR (*cur)
|
||||
static vfsid sfs_getid (vfs *me, char *path, struct vfs_stamping **parent)
|
||||
{ /* FIXME: what should I do? */
|
||||
vfs *v;
|
||||
vfsid id;
|
||||
struct vfs_stamping *par;
|
||||
struct cachedfile **cur = &head;
|
||||
struct cachedfile *cur = head;
|
||||
|
||||
while (CUR) {
|
||||
if ((!strcmp( path, CUR->name )) &&
|
||||
(vfs_uid == CUR->uid))
|
||||
while (cur) {
|
||||
if ((!strcmp( path, cur->name )) &&
|
||||
(vfs_uid == cur->uid))
|
||||
break;
|
||||
CUR = CUR->next;
|
||||
cur = cur->next;
|
||||
}
|
||||
if (!CUR)
|
||||
if (!cur)
|
||||
vfs_die( "sfs_getid of noncached thingie?" );
|
||||
|
||||
*parent = NULL;
|
||||
@ -240,19 +239,19 @@ static vfsid sfs_getid (vfs *me, char *path, struct vfs_stamping **parent)
|
||||
static void sfs_free (vfsid id)
|
||||
{
|
||||
struct cachedfile *which = (struct cachedfile *) id;
|
||||
struct cachedfile **cur = &head;
|
||||
struct cachedfile *cur, *prev;
|
||||
|
||||
unlink( CUR->cache );
|
||||
while (CUR) {
|
||||
if (CUR == which)
|
||||
break;
|
||||
CUR = CUR->next;
|
||||
}
|
||||
if (!CUR)
|
||||
for (cur = head, prev = 0; cur && cur != which; prev = cur, cur = cur->next)
|
||||
;
|
||||
if (!cur)
|
||||
vfs_die( "Free of thing which is unknown to me\n" );
|
||||
*cur = CUR->next;
|
||||
unlink (cur->cache);
|
||||
|
||||
if (prev)
|
||||
prev->next = cur->next;
|
||||
else
|
||||
head = cur->next;
|
||||
}
|
||||
#undef CUR
|
||||
|
||||
static void sfs_fill_names (vfs *me, void (*func)(char *))
|
||||
{
|
||||
|
@ -1150,9 +1150,16 @@ timeoutcmp (struct timeval *t1, struct timeval *t2)
|
||||
void
|
||||
vfs_timeout_handler (void)
|
||||
{
|
||||
static int locked;
|
||||
struct timeval time;
|
||||
struct vfs_stamping *stamp, *st;
|
||||
|
||||
/* Avoid recursive invocation, e.g. when one of the free functions
|
||||
calls message_1s */
|
||||
if (locked)
|
||||
return;
|
||||
locked = 1;
|
||||
|
||||
gettimeofday (&time, NULL);
|
||||
time.tv_sec -= vfs_timeout;
|
||||
|
||||
@ -1165,6 +1172,7 @@ vfs_timeout_handler (void)
|
||||
} else
|
||||
stamp = stamp->next;
|
||||
}
|
||||
locked = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user