Couple of patches
- From: "Andrew V. Samoilov" <andrew email zp ua>
- To: mc-devel gnome org
- Subject: Couple of patches
- Date: Thu, 25 Nov 2004 13:06:17 +0200 (EET)
Hi,
--
Regards,
Andrew V. Samoilov.
vfs/ChangeLog:
* direntry.c (vfs_s_open): Fix memory leak.
(vfs_s_retrieve_file): Check write() return more carefully.
--- vfs/direntry.c.sav Mon Oct 18 13:02:09 2004
+++ vfs/direntry.c Thu Nov 25 12:36:29 2004
@@ -720,8 +720,10 @@ vfs_s_open (struct vfs_class *me, const
if ((q = vfs_s_get_path (me, file, &super, 0)) == NULL)
return NULL;
ino = vfs_s_find_inode (me, super, q, LINK_FOLLOW, FL_NONE);
- if (ino && ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)))
+ if (ino && ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))) {
+ g_free (q);
ERRNOR (EEXIST, NULL);
+ }
if (!ino) {
char *dirname, *name, *save;
struct vfs_s_entry *ent;
@@ -955,7 +957,7 @@ vfs_s_retrieve_file (struct vfs_class *m
if (got_interrupt ())
goto error_1;
- if (write (handle, buffer, n) < 0) {
+ if (write (handle, buffer, n) != n) {
me->verrno = errno;
goto error_1;
}
src/ChangeLog:
* execute.c (shell_execute): Optimize memory usage.
--- src/execute.c.sav Fri Nov 19 09:31:29 2004
+++ src/execute.c Thu Nov 25 12:14:12 2004
@@ -174,26 +174,25 @@ do_execute (const char *shell, const cha
void
shell_execute (const char *command, int flags)
{
- char *cmd;
+ char *cmd = NULL;
- if(flags & EXECUTE_HIDE) {
+ if (flags & EXECUTE_HIDE) {
cmd = g_strconcat (" ", command, (char *) NULL);
flags ^= EXECUTE_HIDE;
- } else
- cmd = g_strdup(command);
+ }
#ifdef HAVE_SUBSHELL_SUPPORT
if (use_subshell)
if (subshell_state == INACTIVE)
- do_execute (shell, cmd, flags | EXECUTE_AS_SHELL);
+ do_execute (shell, cmd ? cmd : command, flags | EXECUTE_AS_SHELL);
else
message (1, MSG_ERROR,
_(" The shell is already running a command "));
else
#endif /* HAVE_SUBSHELL_SUPPORT */
- do_execute (shell, cmd, flags | EXECUTE_AS_SHELL);
+ do_execute (shell, cmd ? cmd : command, flags | EXECUTE_AS_SHELL);
- g_free(cmd);
+ g_free (cmd);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]