diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 757ca0666..81c7fed82 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,9 @@ +1999-08-30 Miguel de Icaza + + * ftpfs.c (insert_dots): Use g_new here. + + * shared_ftpfs_fish.c: Style fixes and small fixes + 1999-09-22 Bjorn Eriksson * extfs/uzip.in: Better handling of zip-archives that contain files diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 4c42cf8aa..e7d77b866 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -1276,7 +1276,7 @@ insert_dots (struct linklist *file_list, struct connection *bucket) }; for (i = 0; i < 2; i++ ) { - fe = malloc(sizeof(struct direntry)); + fe = g_new (struct direntry, 1); if (fe == NULL) return; if (vfs_parse_ls_lga (buffer[i], &fe->s, &fe->name, &fe->linkname)) { @@ -1288,9 +1288,9 @@ insert_dots (struct linklist *file_list, struct connection *bucket) (fe->s).st_ino = bucket->__inode_counter++; if (!linklist_insert(file_list, fe)) - free(fe); + g_free(fe); } else - free (fe); + g_free (fe); } } diff --git a/vfs/shared_ftp_fish.c b/vfs/shared_ftp_fish.c index 81c22c4c3..f0be98c44 100644 --- a/vfs/shared_ftp_fish.c +++ b/vfs/shared_ftp_fish.c @@ -308,11 +308,15 @@ _get_file_entry(struct connection *bucket, char *file_name, fmode = S_ISLNK(ent->s.st_mode) ? ent->l_stat->st_mode : ent->s.st_mode; - if (S_ISDIR(fmode)) ERRNOR (EISDIR, NULL); - if (!S_ISREG(fmode)) ERRNOR (EPERM, NULL); - if ((flags & O_EXCL) && (flags & O_CREAT)) ERRNOR (EEXIST, NULL); + if (S_ISDIR(fmode)) + ERRNOR (EISDIR, NULL); + if (!S_ISREG(fmode)) + ERRNOR (EPERM, NULL); + if ((flags & O_EXCL) && (flags & O_CREAT)) + ERRNOR (EEXIST, NULL); if (ent->remote_filename == NULL) - if (!(ent->remote_filename = g_strdup(file_name))) ERRNOR (ENOMEM, NULL); + if (!(ent->remote_filename = g_strdup(file_name))) + ERRNOR (ENOMEM, NULL); if (ent->local_filename == NULL || !ent->local_stat.st_mtime || stat (ent->local_filename, &sb) < 0 || @@ -354,8 +358,8 @@ _get_file_entry(struct connection *bucket, char *file_name, int handle; ent = g_new (struct direntry, 1); - ent->freshly_created = 0; if (ent == NULL) ERRNOR (ENOMEM, NULL); + ent->freshly_created = 0; ent->count = 1; ent->linkname = NULL; ent->l_stat = NULL; @@ -363,11 +367,11 @@ _get_file_entry(struct connection *bucket, char *file_name, ent->name = g_strdup(p); ent->remote_filename = g_strdup(file_name); ent->local_filename = tempnam (NULL, X "fs"); - if (!ent->name && !ent->remote_filename && !ent->local_filename) { + if (!ent->name || !ent->remote_filename || !ent->local_filename) { direntry_destructor(ent); ERRNOR (ENOMEM, NULL); } - handle = creat(ent->local_filename, 0700); + handle = open (ent->local_filename, O_CREAT | O_EXCL | O_RDWR | O_TRUNC, 0700); if (handle == -1) { my_errno = EIO; goto error;