mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 17:29:28 +03:00
* extfs.h: Remove "extfsstat" from struct archive - it's unused
outside open_archive(). Adjust the dependencies. * extfs.c: Make hstat local variable.
This commit is contained in:
parent
271a2564fd
commit
03b1481cda
@ -1,5 +1,9 @@
|
||||
2002-12-05 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* extfs.h: Remove "extfsstat" from struct archive - it's unused
|
||||
outside open_archive(). Adjust the dependencies.
|
||||
* extfs.c: Make hstat local variable.
|
||||
|
||||
* sfs.c: Remove "uid" from struct cachedfile - it's unused now.
|
||||
|
||||
* vfs.h: Remove vfs_uid and vfs_gid. Fix all dependencies.
|
||||
|
45
vfs/extfs.c
45
vfs/extfs.c
@ -85,7 +85,6 @@ static void remove_entry (struct entry *e);
|
||||
|
||||
static struct archive *first_archive = NULL;
|
||||
static int my_errno = 0;
|
||||
static struct stat hstat; /* Stat struct corresponding */
|
||||
|
||||
#define MAXEXTFS 32
|
||||
static char *extfs_prefixes [MAXEXTFS];
|
||||
@ -199,7 +198,8 @@ static void free_archive (struct archive *archive)
|
||||
g_free (archive);
|
||||
}
|
||||
|
||||
static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
||||
static FILE *
|
||||
open_archive (int fstype, char *name, struct archive **pparc)
|
||||
{
|
||||
static dev_t __extfs_no = 0;
|
||||
FILE *result;
|
||||
@ -224,8 +224,9 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
||||
}
|
||||
|
||||
mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
|
||||
cmd = g_strconcat (mc_extfsdir, extfs_prefixes [fstype],
|
||||
" list ", local_name ? local_name : tmp, NULL);
|
||||
cmd =
|
||||
g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ",
|
||||
local_name ? local_name : tmp, NULL);
|
||||
if (tmp)
|
||||
g_free (tmp);
|
||||
g_free (mc_extfsdir);
|
||||
@ -248,11 +249,10 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
||||
mc_stat (local_name, ¤t_archive->local_stat);
|
||||
current_archive->__inode_counter = 0;
|
||||
current_archive->fd_usage = 0;
|
||||
current_archive->extfsstat = mystat;
|
||||
current_archive->rdev = __extfs_no++;
|
||||
current_archive->next = first_archive;
|
||||
first_archive = current_archive;
|
||||
mode = current_archive->extfsstat.st_mode & 07777;
|
||||
mode = mystat.st_mode & 07777;
|
||||
if (mode & 0400)
|
||||
mode |= 0100;
|
||||
if (mode & 0040)
|
||||
@ -261,11 +261,11 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
||||
mode |= 0001;
|
||||
mode |= S_IFDIR;
|
||||
root_entry = generate_entry (current_archive, "/", NULL, mode);
|
||||
root_entry->inode->uid = current_archive->extfsstat.st_uid;
|
||||
root_entry->inode->gid = current_archive->extfsstat.st_gid;
|
||||
root_entry->inode->atime = current_archive->extfsstat.st_atime;
|
||||
root_entry->inode->ctime = current_archive->extfsstat.st_ctime;
|
||||
root_entry->inode->mtime = current_archive->extfsstat.st_mtime;
|
||||
root_entry->inode->uid = mystat.st_uid;
|
||||
root_entry->inode->gid = mystat.st_gid;
|
||||
root_entry->inode->atime = mystat.st_atime;
|
||||
root_entry->inode->ctime = mystat.st_ctime;
|
||||
root_entry->inode->mtime = mystat.st_mtime;
|
||||
current_archive->root_entry = root_entry;
|
||||
current_archive->current_dir = root_entry;
|
||||
|
||||
@ -278,14 +278,14 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
||||
* Main loop for reading an archive.
|
||||
* Returns 0 on success, -1 on error.
|
||||
*/
|
||||
static int read_archive (int fstype, char *name, struct archive **pparc)
|
||||
static int
|
||||
read_archive (int fstype, char *name, struct archive **pparc)
|
||||
{
|
||||
FILE *extfsd;
|
||||
char *buffer;
|
||||
struct archive *current_archive;
|
||||
char *current_file_name, *current_link_name;
|
||||
|
||||
|
||||
if ((extfsd = open_archive (fstype, name, ¤t_archive)) == NULL) {
|
||||
message_3s (1, MSG_ERROR, _("Couldn't open %s archive\n%s"),
|
||||
extfs_prefixes[fstype], name);
|
||||
@ -294,8 +294,11 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
|
||||
|
||||
buffer = g_malloc (4096);
|
||||
while (fgets (buffer, 4096, extfsd) != NULL) {
|
||||
struct stat hstat;
|
||||
|
||||
current_link_name = NULL;
|
||||
if (vfs_parse_ls_lga (buffer, &hstat, ¤t_file_name, ¤t_link_name)) {
|
||||
if (vfs_parse_ls_lga
|
||||
(buffer, &hstat, ¤t_file_name, ¤t_link_name)) {
|
||||
struct entry *entry, *pent;
|
||||
struct inode *inode;
|
||||
char *p, *q, *cfn = current_file_name;
|
||||
@ -314,8 +317,8 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
|
||||
*(p++) = 0;
|
||||
q = cfn;
|
||||
}
|
||||
if (S_ISDIR (hstat.st_mode) &&
|
||||
(!strcmp (p, ".") || !strcmp (p, "..")))
|
||||
if (S_ISDIR (hstat.st_mode)
|
||||
&& (!strcmp (p, ".") || !strcmp (p, "..")))
|
||||
goto read_extfs_continue;
|
||||
pent = find_entry (current_archive->root_entry, q, 1, 0);
|
||||
if (pent == NULL) {
|
||||
@ -336,12 +339,15 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
|
||||
}
|
||||
}
|
||||
if (!S_ISLNK (hstat.st_mode) && current_link_name != NULL) {
|
||||
pent = find_entry (current_archive->root_entry, current_link_name, 0, 0);
|
||||
pent =
|
||||
find_entry (current_archive->root_entry,
|
||||
current_link_name, 0, 0);
|
||||
if (pent == NULL) {
|
||||
/* FIXME: Should clean everything one day */
|
||||
g_free (buffer);
|
||||
pclose (extfsd);
|
||||
close_error_pipe (1, _("Inconsistent extfs archive"));
|
||||
close_error_pipe (1,
|
||||
_("Inconsistent extfs archive"));
|
||||
return -1;
|
||||
} else {
|
||||
entry->inode = pent->inode;
|
||||
@ -367,7 +373,8 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
|
||||
inode->mtime = hstat.st_mtime;
|
||||
inode->atime = hstat.st_atime;
|
||||
inode->ctime = hstat.st_ctime;
|
||||
if (current_link_name != NULL && S_ISLNK (hstat.st_mode)) {
|
||||
if (current_link_name != NULL
|
||||
&& S_ISLNK (hstat.st_mode)) {
|
||||
inode->linkname = current_link_name;
|
||||
current_link_name = NULL;
|
||||
} else {
|
||||
|
@ -22,7 +22,6 @@ struct archive {
|
||||
int fstype;
|
||||
char *name;
|
||||
char *local_name;
|
||||
struct stat extfsstat;
|
||||
struct stat local_stat;
|
||||
dev_t rdev;
|
||||
int fd_usage;
|
||||
|
Loading…
Reference in New Issue
Block a user