mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Wed Apr 21 21:47:15 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* src/ext.c (exec_extension): Use tempnam instead of tmpnam (AIX doesn't like the lattern when compiled with -mthreads). * src/user.c (execute_menu_command): ditto. Wed Apr 21 22:04:30 1999 Norbert Warmuth <nwarmuth@privat.circular.de> * gtkedit/editcmd.c (edit_save_file): MAD knows about tempnam, no need to fool it by strdup'ing the return value of tempnam. Wed Apr 21 21:59:50 1999 Norbert Warmuth <nwarmuth@privat.circular.de> * vfs/extfs.c (extfs_open): tempnam returns a malloced string, no need to strdup it (various places): use free instead of g_free to free string returned by tempnam.
This commit is contained in:
parent
3fd90ce83b
commit
2b862fe4f1
@ -1,3 +1,8 @@
|
||||
Wed Apr 21 22:04:30 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* gtkedit/editcmd.c (edit_save_file): MAD knows about tempnam, no
|
||||
need to fool it by strdup'ing the return value of tempnam.
|
||||
|
||||
Wed Apr 21 20:44:41 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* configure.in: New option --with-tm-x-support, use MCCFLAGS and
|
||||
|
@ -262,11 +262,8 @@ int edit_save_file (WEdit * edit, const char *filename)
|
||||
return 0;
|
||||
savedir[slashpos - filename + 1] = '\0';
|
||||
}
|
||||
#ifdef HAVE_MAD
|
||||
savename = strdup (tempnam (savedir, "cooledit"));
|
||||
#else
|
||||
savename = tempnam (savedir, "cooledit");
|
||||
#endif
|
||||
|
||||
if (slashpos)
|
||||
free (savedir);
|
||||
if (!savename)
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Apr 21 21:47:15 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* ext.c (exec_extension): Use tempnam instead of tmpnam (AIX doesn't
|
||||
like the latter when compiled with -mthreads).
|
||||
|
||||
* user.c (execute_menu_command): ditto.
|
||||
|
||||
Wed Apr 21 20:40:38 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* Makefile.in: use MCCFLAGS and MCLIBS
|
||||
|
16
src/ext.c
16
src/ext.c
@ -127,15 +127,17 @@ exec_extension (const char *filename, const char *data, char **drops, int *move_
|
||||
else
|
||||
do_local_copy = 0;
|
||||
|
||||
/* Note: this has to be done after the getlocalcopy call,
|
||||
* since it uses tmpnam as well
|
||||
*/
|
||||
file_name = g_strdup (tmpnam (NULL));
|
||||
if ((file_name = tempnam (NULL, "mcext")) == 0) {
|
||||
message (1, MSG_ERROR, _(" Can't generate unique filename \n %s "),
|
||||
unix_error_string (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
/* #warning FIXME: this is ugly */
|
||||
if ((cmd_file_fd = open (file_name, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600)) == -1){
|
||||
message (1, MSG_ERROR, _(" Can't create temporary command file \n %s "),
|
||||
unix_error_string (errno));
|
||||
free (file_name);
|
||||
return;
|
||||
}
|
||||
cmd_file = fdopen (cmd_file_fd, "w");
|
||||
@ -156,7 +158,7 @@ exec_extension (const char *filename, const char *data, char **drops, int *move_
|
||||
if (localcopy) {
|
||||
mc_ungetlocalcopy (filename, localcopy, 0);
|
||||
}
|
||||
g_free (file_name);
|
||||
free (file_name);
|
||||
return;
|
||||
}
|
||||
fputs (parameter, cmd_file);
|
||||
@ -200,7 +202,7 @@ exec_extension (const char *filename, const char *data, char **drops, int *move_
|
||||
if (localcopy == NULL) {
|
||||
fclose(cmd_file);
|
||||
unlink(file_name);
|
||||
g_free (file_name);
|
||||
free (file_name);
|
||||
return;
|
||||
}
|
||||
mc_stat (localcopy, &mystat);
|
||||
@ -308,7 +310,7 @@ exec_extension (const char *filename, const char *data, char **drops, int *move_
|
||||
mc_stat (localcopy, &mystat);
|
||||
mc_ungetlocalcopy (filename, localcopy, localmtime != mystat.st_mtime);
|
||||
}
|
||||
g_free (file_name);
|
||||
free (file_name);
|
||||
}
|
||||
|
||||
#ifdef FILE_L
|
||||
|
17
src/user.c
17
src/user.c
@ -497,15 +497,27 @@ execute_menu_command (char *s)
|
||||
int do_quote;
|
||||
char prompt [80] = "";
|
||||
int col;
|
||||
char *file_name = tmpnam (0);
|
||||
char *file_name;
|
||||
#ifdef OS2_NT
|
||||
char *p;
|
||||
#endif
|
||||
|
||||
if ((file_name = tempnam (NULL, "mcusr")) == 0) {
|
||||
message (1, MSG_ERROR, _(" Can't generate unique filename \n %s "),
|
||||
unix_error_string (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef OS2_NT
|
||||
/* OS/2 and NT requires the command to end in .cmd */
|
||||
p = file_name;
|
||||
file_name = g_strconcat (file_name, ".cmd", NULL);
|
||||
free (p);
|
||||
#endif
|
||||
if ((cmd_file_fd = open (file_name, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600)) == -1){
|
||||
message (1, MSG_ERROR, _(" Can't create temporary command file \n %s "),
|
||||
unix_error_string (errno));
|
||||
free (file_name);
|
||||
return;
|
||||
}
|
||||
cmd_file = fdopen (cmd_file_fd, "w");
|
||||
@ -513,6 +525,7 @@ execute_menu_command (char *s)
|
||||
if (!commands){
|
||||
fclose (cmd_file);
|
||||
unlink (file_name);
|
||||
free (file_name);
|
||||
return;
|
||||
}
|
||||
commands++;
|
||||
@ -536,6 +549,7 @@ execute_menu_command (char *s)
|
||||
/* User canceled */
|
||||
fclose (cmd_file);
|
||||
unlink (file_name);
|
||||
free (file_name);
|
||||
return;
|
||||
}
|
||||
if (do_quote) {
|
||||
@ -579,6 +593,7 @@ execute_menu_command (char *s)
|
||||
chmod (file_name, S_IRWXU);
|
||||
execute (file_name);
|
||||
unlink (file_name);
|
||||
free (file_name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,3 +1,11 @@
|
||||
Wed Apr 21 21:59:50 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* extfs.c (extfs_open): tempnam returns a malloced string, no need
|
||||
to strdup it
|
||||
|
||||
(various places): use free instead of g_free to free string returned
|
||||
by tempnam.
|
||||
|
||||
1999-04-21 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
|
||||
|
||||
* urar.in, uzip.in: rolled in patches from "christian.gennerat"
|
||||
|
@ -603,7 +603,7 @@ static void *extfs_open (vfs *me, char *file, int flags, int mode)
|
||||
char *cmd;
|
||||
char *archive_name, *p;
|
||||
|
||||
entry->inode->local_filename = g_strdup (tempnam (NULL, "extfs"));
|
||||
entry->inode->local_filename = tempnam (NULL, "extfs");
|
||||
{
|
||||
int handle;
|
||||
|
||||
@ -626,7 +626,7 @@ static void *extfs_open (vfs *me, char *file, int flags, int mode)
|
||||
g_free (mc_extfsdir);
|
||||
g_free (archive_name);
|
||||
if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID | EXECUTE_WAIT, shell, cmd) && !do_create){
|
||||
g_free (entry->inode->local_filename);
|
||||
free (entry->inode->local_filename);
|
||||
entry->inode->local_filename = NULL;
|
||||
g_free (cmd);
|
||||
my_errno = EIO;
|
||||
@ -954,7 +954,7 @@ static void remove_entry (struct entry *e)
|
||||
if (i <= 0) {
|
||||
if (e->inode->local_filename != NULL) {
|
||||
unlink (e->inode->local_filename);
|
||||
g_free (e->inode->local_filename);
|
||||
free (e->inode->local_filename);
|
||||
}
|
||||
if (e->inode->linkname != NULL)
|
||||
g_free (e->inode->linkname);
|
||||
@ -977,7 +977,7 @@ static void free_entry (struct entry *e)
|
||||
if (i <= 0) {
|
||||
if (e->inode->local_filename != NULL) {
|
||||
unlink (e->inode->local_filename);
|
||||
g_free (e->inode->local_filename);
|
||||
free (e->inode->local_filename);
|
||||
}
|
||||
if (e->inode->linkname != NULL)
|
||||
g_free (e->inode->linkname);
|
||||
|
Loading…
Reference in New Issue
Block a user