diff --git a/vfs/ChangeLog b/vfs/ChangeLog index f57ed173c..a5f64afa5 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,13 @@ +Sat Nov 21 21:38:08 1998 Pavel Machek + + * vfs.c (vfs_parse_ls_lga): corrected stupid bug in parse_ls_lga, + thanks to Pavel Roskin for reporting + + * direntry.c (vfs_s_lseek): -1 is invalid filehandle, not 0 + + * utilvfs.c (vfs_split_url): initialize variables so that we do + not return garbage + Sat Nov 7 20:19:14 1998 Pavel Machek * vfs.c: Converted g_return_if_fail into vfs_dies(), removed them diff --git a/vfs/Make-mc.in b/vfs/Make-mc.in index 2c646530a..b1ec2b7a9 100644 --- a/vfs/Make-mc.in +++ b/vfs/Make-mc.in @@ -102,14 +102,18 @@ VFSSOOBJS = tcputil.so fish.so ftpfs.so mcfs.so utilvfs.so local.so vfs.so \ util.sor utilunix.sor direntry.so %.sor: ../src/%.c - $(CC) -fpic -c $(CPPFLAGS) $(DEFS) $(CFLAGS) -DVFS_STANDALONE $< -o $@ + $(CC) -fpic -Wall -c $(CPPFLAGS) $(DEFS) $(CFLAGS) -DVFS_STANDALONE $< -o $@ %.so: %.c - $(CC) -fpic -c $(CPPFLAGS) $(DEFS) $(CFLAGS) -DVFS_STANDALONE $< -o $@ + $(CC) -fpic -Wall -c $(CPPFLAGS) $(DEFS) $(CFLAGS) -DVFS_STANDALONE $< -o $@ libvfs.so: $(VFSSOOBJS) gcc $(VFSSOOBJS) -shared -o libvfs.so +libvfs.a: $(VFSSOOBJS) + $(RMF) $@ + $(AR) cr $@ $(VFSSOOBJS) + -$(RANLIB) $@ Makefile: $(srcdir)/Make-mc.in $(builddir)/config.status cd $(builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -159,7 +163,7 @@ TAGS: $(VFSSRCS) etags $(VFSSRCS) clean: - $(RMF) mcserv *.o core a.out libvfs-mc.a mcservx *.so *.sor + $(RMF) mcserv *.o core a.out *.a mcservx *.so *.sor realclean: clean $(RMF) .depend diff --git a/vfs/direntry.c b/vfs/direntry.c index 72606e3ea..04c4eb603 100644 --- a/vfs/direntry.c +++ b/vfs/direntry.c @@ -750,7 +750,7 @@ int vfs_s_lseek (void *fh, off_t offset, int whence) { off_t size = FH->ino->st.st_size; - if (FH->handle) { /* If we have local file opened, we want to work with it */ + if (FH->handle != -1) { /* If we have local file opened, we want to work with it */ int retval = lseek(FH->handle, offset, whence); if (retval == -1) FH->ino->super->me->verrno = errno; diff --git a/vfs/utilvfs.c b/vfs/utilvfs.c index b438c312e..fee802d5f 100644 --- a/vfs/utilvfs.c +++ b/vfs/utilvfs.c @@ -72,9 +72,10 @@ char *vfs_split_url (char *path, char **host, char **user, int *port, char **pas *pass = NULL; *port = default_port; *user = NULL; + retval = NULL; dir = pcopy; - if (!flags & URL_NOSLASH) { + if (!(flags & URL_NOSLASH)) { /* locate path component */ for (; *dir != '/' && *dir; dir++) ; diff --git a/vfs/vfs.c b/vfs/vfs.c index b3a79911b..2682fafbb 100644 --- a/vfs/vfs.c +++ b/vfs/vfs.c @@ -475,8 +475,6 @@ mc_opendir (char *dirname) char *p = NULL; int i = strlen (dirname); -message_1s(1, " Opening ", dirname ); - if (dirname [i - 1] != '/'){ /* We should make possible reading of the root directory in a tar file */ p = xmalloc (i + 2, "slash"); @@ -1486,7 +1484,7 @@ vfs_parse_ls_lga (char *p, struct stat *s, char **filename, char **linkname) if (strncmp (p, "total", 5) == 0) return 0; - p_copy = strdup (p); + p_copy = strdup(p); if ((i = vfs_parse_filetype(*(p++))) == -1) goto error; @@ -1506,7 +1504,9 @@ vfs_parse_ls_lga (char *p, struct stat *s, char **filename, char **linkname) s->st_mode |= i; p += 9; } - + + free(p_copy); + p_copy = strdup(p); num_cols = vfs_split_text (p); s->st_nlink = atol (columns [0]); @@ -1644,7 +1644,8 @@ vfs_parse_ls_lga (char *p, struct stat *s, char **filename, char **linkname) error: message_1s (1, "Could not parse:", p_copy); - free (p_copy); + if (p_copy != p) /* Carefull! */ + free (p_copy); return 0; }