rearrange Makefile; start working on correct fixes. still a few warnings

to go.
This commit is contained in:
fgsch 2000-04-28 23:33:16 +00:00
parent 129cd49a19
commit 7a0f6624dc
6 changed files with 130 additions and 63 deletions

View File

@ -1,25 +1,21 @@
# $OpenBSD: Makefile,v 1.5 2000/04/09 17:37:11 espie Exp $
# $OpenBSD: Makefile,v 1.6 2000/04/28 23:33:16 fgsch Exp $
BROKEN= "patches are way wrong; auditing requiered."
DISTNAME= mc-4.1.35
CATEGORIES= misc
MASTER_SITES= ${MASTER_SITE_GNU}
MASTER_SITE_SUBDIR= mc
DISTNAME= mc-4.1.35
CATEGORIES= misc
FAKE=No
MASTER_SITES= ftp://ftp.nodomainname.net/pub/mirrors/gnu/mc/ \
ftp://ftp.freesoftware.com/pub/gnu/mc/ \
ftp://labrea.stanford.edu/pub/gnu/mc/ \
ftp://aeneas.mit.edu/pub/gnu/mc/ \
ftp://ftp.cs.ubc.ca/mirror2/gnu/mc/ \
ftp://core.ring.gr.jp/pub/GNU/mc/ \
ftp://ftp.gnu.org/pub/gnu/mc/
MAINTAINER= ryan@erwin.org
MAINTAINER= ryan@erwin.org
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
GNU_CONFIGURE= Yes
FAKE= No
GNU_CONFIGURE= Yes
#BROKEN= "security is bad; auditing on the way"
.include <bsd.port.mk>

View File

@ -1,11 +1,11 @@
--- src/user.c.orig Sun Jan 16 01:19:51 2000
+++ src/user.c Sun Jan 16 01:20:08 2000
@@ -497,7 +497,7 @@ void execute_menu_command (char *s)
int do_quote;
char prompt [80] = "";
int col;
- char *file_name = tmpnam (0);
+ char *file_name = mkstemp (0);
--- vfs/tcputil.c.orig Mon May 25 07:16:04 1998
+++ vfs/tcputil.c Tue Apr 25 14:15:27 2000
@@ -240,7 +240,7 @@ void rpc_add_get_callback (int sock, voi
sock_callbacks = new;
}
#ifdef OS2_NT
/* OS/2 and NT requires the command to end in .cmd */
-#if defined(IS_AIX) || defined(linux) || defined(SCO_FLAVOR) || defined(__QNX__)
+#if defined(IS_AIX) || defined(linux) || defined(SCO_FLAVOR) || defined(__QNX__) || defined(__OpenBSD__)
static void sig_pipe (int unused)
#else
static void sig_pipe (void)

View File

@ -1,11 +1,19 @@
--- src/ext.c.orig Sun Jan 16 01:20:19 2000
+++ src/ext.c Sun Jan 16 01:20:38 2000
@@ -133,7 +133,7 @@ exec_extension (char *filename, char *da
--- src/ext.c.orig Mon May 25 07:16:07 1998
+++ src/ext.c Tue Apr 25 19:26:36 2000
@@ -133,9 +133,16 @@ exec_extension (char *filename, char *da
/* Note: this has to be done after the getlocalcopy call,
* since it uses tmpnam as well
*/
- file_name = strdup (tmpnam (NULL));
+ file_name = strdup (mkstemp (NULL));
+#ifdef __OpenBSD__
+#define TEMPFILE "/tmp/mcXXXXXXXXXX"
+ file_name = xmalloc (sizeof(TEMPFILE), TEMPFILE);
+ strcpy (file_name, TEMPFILE);
+ if ((cmd_file_fd = mkstemp (file_name)) == -1) {
+#else
file_name = strdup (tmpnam (NULL));
if ((cmd_file_fd = open (file_name, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600)) == -1){
+#endif
message (1, MSG_ERROR, _(" Can't create temporary command file \n %s "),
unix_error_string (errno));
return;

View File

@ -1,11 +1,11 @@
--- vfs/vfs.c.orig Sun Jan 16 01:26:28 2000
+++ vfs/vfs.c Sun Jan 16 01:26:50 2000
@@ -1274,7 +1274,7 @@ char *mc_def_getlocalcopy (char *filenam
fdin = mc_open (filename, O_RDONLY);
if (fdin == -1)
return NULL;
- tmp = tmpnam(NULL);
+ tmp = mkstemp(NULL);
fdout = creat (tmp, 0600);
if (fdout == -1) {
mc_close (fdin);
--- vfs/mcserv.c.orig Mon Apr 24 13:39:16 2000
+++ vfs/mcserv.c Mon Apr 24 13:39:59 2000
@@ -912,7 +912,7 @@ do_auth (char *username, char *password)
#endif
#endif
-#ifndef BSD
+#if !defined(BSD) || defined(__OpenBSD__)
if (setuid (this->pw_uid))
#else
if (setreuid (this->pw_uid, this->pw_uid))

View File

@ -1,11 +1,57 @@
--- vfs/tar.c.orig Sun Jan 16 01:27:50 2000
+++ vfs/tar.c Sun Jan 16 01:28:27 2000
@@ -345,7 +345,7 @@ static INLINE int uncompress_tar_file (
char buffer [8192]; /* Changed to 8K: better transfer size */
current_archive->is_gzipped = tar_uncompressed_local;
- current_archive->tmpname = strdup (tmpnam (NULL));
+ current_archive->tmpname = strdup (mkstemp (NULL));
/* Some security is sometimes neccessary :) */
command = copy_strings ("touch ", current_archive->tmpname,
--- src/user.c.orig Mon May 25 07:16:07 1998
+++ src/user.c Tue Apr 25 19:13:52 2000
@@ -497,13 +497,24 @@ void execute_menu_command (char *s)
int do_quote;
char prompt [80] = "";
int col;
+#ifdef __OpenBSD__
+ char *file_name;
+#else
char *file_name = tmpnam (0);
+#endif
#ifdef OS2_NT
/* OS/2 and NT requires the command to end in .cmd */
file_name = copy_strings (file_name, ".cmd", NULL);
#endif
+#ifdef __OpenBSD__
+#define TEMPFILE "/tmp/mcXXXXXXXXXX"
+ file_name = xmalloc (sizeof(TEMPFILE), TEMPFILE);
+ strcpy (file_name, TEMPFILE);
+ if ((cmd_file_fd = mkstemp (file_name)) == -1) {
+#else
if ((cmd_file_fd = open (file_name, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600)) == -1){
+#endif
message (1, MSG_ERROR, _(" Can't create temporary command file \n %s "),
unix_error_string (errno));
return;
@@ -513,6 +524,9 @@ void execute_menu_command (char *s)
if (!commands){
fclose (cmd_file);
unlink (file_name);
+#ifdef __OpenBSD__
+ free (file_name);
+#endif
return;
}
commands++;
@@ -536,6 +550,9 @@ void execute_menu_command (char *s)
/* User canceled */
fclose (cmd_file);
unlink (file_name);
+#ifdef __OpenBSD__
+ free (file_name);
+#endif
return;
}
if (do_quote) {
@@ -579,6 +596,9 @@ void execute_menu_command (char *s)
chmod (file_name, S_IRWXU);
execute (file_name);
unlink (file_name);
+#ifdef __OpenBSD__
+ free (file_name);
+#endif
}
/*

View File

@ -1,11 +1,28 @@
--- vfs/extfs.c.orig Sun Jan 16 01:31:07 2000
+++ vfs/extfs.c Sun Jan 16 01:31:27 2000
@@ -749,7 +749,7 @@ static void *extfs_open (char *file, int
if (entry->inode->local_filename == NULL) {
char *cmd, *archive_name;
- entry->inode->local_filename = strdup (tmpnam (NULL));
+ entry->inode->local_filename = strdup (mkstemp (NULL));
p = extfs_get_path_from_entry (entry);
q = name_quote (p, 0);
free (p);
--- vfs/vfs.c.orig Mon May 25 07:16:04 1998
+++ vfs/vfs.c Thu Apr 27 11:20:45 2000
@@ -1274,13 +1274,25 @@
fdin = mc_open (filename, O_RDONLY);
if (fdin == -1)
return NULL;
+#ifdef __OpenBSD__
+#define TEMPFILE "/tmp/mcXXXXXXXXXX"
+ tmp = xmalloc (sizeof(TEMPFILE), TEMPFILE);
+ strcpy (tmp, TEMPFILE);
+ fdout = mkstemp (tmp);
+#else
tmp = tmpnam(NULL);
fdout = creat (tmp, 0600);
+#endif
if (fdout == -1) {
mc_close (fdin);
+#ifdef __OpenBSD__
+ free (tmp);
+#endif
return NULL;
}
+#ifndef __OpenBSD__
tmp = strdup (tmp);
+#endif
while ((i = mc_read (fdin, buffer, sizeof (buffer))) == sizeof (buffer)) {
write (fdout, buffer, i);
}