Fix warnings. Default to ssh. Don't insist, that the remote hostname

resolves -- it may be an entry from ssh's config file.

Use ftruncate -- we have it. Bump PORTREVISION.

Skimmed over by:	peter (past maintainer)
This commit is contained in:
Mikhail Teterin 2005-02-04 00:45:31 +00:00
parent 277fa15535
commit cfae8997c7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=128009
7 changed files with 168 additions and 11 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= rdist
PORTVERSION= 6.1.5
PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= http://www.magnicomp.com/download/rdist/ \
ftp://ftp.rge.com/pub/admin/rdist/ \

View File

@ -1,9 +1,10 @@
--- config/os-freebsd2.h.orig Mon Nov 9 19:59:55 1998
+++ config/os-freebsd2.h Fri Nov 3 02:40:25 2000
@@ -116,8 +116,10 @@
--- config/os-freebsd2.h Mon Nov 9 22:59:55 1998
+++ config/os-freebsd2.h Tue Jan 18 15:13:07 2005
@@ -116,18 +116,23 @@
*/
#define HAVE_FCHOWN /* Have fchown() */
#define HAVE_FCHMOD /* Have fchmod() */
+#define HAVE_FTRUNCATE /* Have ftruncate() */
+#define HAVE_PATHS_H /* Have paths.h */
#define HAVE_SELECT /* Have select() */
#define HAVE_SAVED_IDS /* Have POSIX style saved [ug]id's */
@ -11,8 +12,16 @@
#define POSIX_SIGNALS /* Have POSIX signals */
/*
@@ -131,3 +133,4 @@
* Things we need
*/
#define NEED_UNISTD_H /* Need <unistd.h> */
+#define NEED_STRING_H /* Need <string.h> -- for strerror(3) */
/*
* Path to the remote shell command.
* Define this only if the pathname is different than
* that which appears in "include/paths.h".
*/
#define _PATH_REMSH "/usr/bin/rsh" /**/
-#define _PATH_REMSH "/usr/bin/rsh" /**/
+#define _PATH_REMSH "/usr/bin/ssh" /**/
+#define _PATH_OLDRDIST "/usr/bin/rdist" /* Enable compat */

View File

@ -1,6 +1,24 @@
--- src/rshrcmd.c.dist Tue Dec 12 08:20:56 1995
+++ src/rshrcmd.c Wed Dec 11 07:14:13 1996
@@ -64,5 +64,5 @@
--- src/rshrcmd.c Mon Nov 9 23:15:07 1998
+++ src/rshrcmd.c Tue Jan 18 14:53:29 2005
@@ -42,5 +42,4 @@
{
int cpid;
- struct hostent *hp;
int sp[2];
@@ -48,11 +47,4 @@
if (fd2p != 0)
return -1;
- /* validate remote hostname. */
- hp = gethostbyname(*ahost);
- if (hp == 0) {
- error("%s: unknown host", *ahost);
- return -1;
- }
- /* *ahost = hp->h_name;*/ /* This makes me nervous. */
/* get a socketpair we'll use for stdin and stdout. */
@@ -72,5 +64,5 @@
sp[0]. */
(void) close(sp[0]);
- if (dup2(sp[1], 0) < 0 || dup2(0,1) < 0 || dup2(0, 2) < 0) {

View File

@ -0,0 +1,9 @@
--- src/client.c Mon Nov 9 23:08:47 1998
+++ src/client.c Tue Jan 18 15:47:15 2005
@@ -762,5 +762,5 @@
char *owner = NULL, *group = NULL;
int done, n;
- u_char *cp;
+ char *cp;
debugmsg(DM_CALL, "update(%s, 0x%x, 0x%x)\n", rname, opts, statp);

View File

@ -1,6 +1,34 @@
--- include/defs.h.orig Mon Nov 9 20:23:54 1998
+++ include/defs.h Fri Nov 3 02:39:45 2000
@@ -379,7 +379,9 @@
--- include/defs.h Mon Nov 9 23:23:54 1998
+++ include/defs.h Tue Jan 18 15:41:40 2005
@@ -17,10 +17,9 @@
/*
* POSIX settings
*/
-#if defined(_POSIX_SOURCE)
#include <unistd.h>
#include <stdlib.h>
-#endif /* _POSIX_SOURCE */
+#include <libgen.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
@@ -357,7 +355,6 @@
extern void complain();
extern void docmds();
extern void finish();
-extern void log();
extern void logmsg();
extern void lostconn();
extern void markassigned();
@@ -366,7 +363,6 @@
extern void runcmdspecial();
extern void runcommand();
extern void server();
-extern void setprogname();
extern void sighandler();
extern void waitup();
struct namelist *expand();
@@ -379,7 +375,9 @@
extern void error(char *, ...);
extern void fatalerr(char *, ...);
extern void message(int, char *, ...);

View File

@ -0,0 +1,47 @@
These patches replace mktemp with mkstemp in the client code entirely.
In the server code more intrusive changes would be needed, so the hunk
simply ensures, the file is not created between the mktemp() and the
open() calls.
-mi
--- src/message.c Mon Nov 9 23:13:30 1998
+++ src/message.c Tue Jan 18 15:23:32 2005
@@ -463,6 +463,6 @@
if (!msgfac->mf_fptr) {
- register char *cp;
- char *getenv();
+ const char *cp;
+ int fd;
/*
@@ -476,6 +476,6 @@
msgfac->mf_filename = tempfile;
- (void) mktemp(msgfac->mf_filename);
- if ((msgfac->mf_fptr = fopen(msgfac->mf_filename, "w"))==NULL)
+ fd = mkstemp(tempfile);
+ if (fd == -1 || (msgfac->mf_fptr = fdopen(fd, "w"))==NULL)
fatalerr("Cannot open notify file for writing: %s: %s.",
msgfac->mf_filename, SYSERR);
@@ -514,5 +514,5 @@
static void _message(flags, msgbuf)
int flags;
- char *msgbuf;
+ const char *msgbuf;
{
register int i, x;
--- src/server.c Mon Nov 9 23:15:31 1998
+++ src/server.c Tue Jan 18 16:34:26 2005
@@ -768,7 +768,7 @@
* Create temporary file
*/
- if ((f = creat(new, mode)) < 0) {
+ if ((f = open(new, O_CREAT|O_TRUNC|O_WRONLY|O_EXCL, mode)) < 0) {
if (errno != ENOENT || chkparent(new, opts) < 0 ||
- (f = creat(new, mode)) < 0) {
+ (f = open(new, O_CREAT|O_TRUNC|O_WRONLY|O_EXCL, mode)) < 0) {
error("%s: create failed: %s", new, SYSERR);
(void) unlink(new);

View File

@ -0,0 +1,45 @@
setprogname() is a standard library function. Instead of renaming
rdist6' (incompatible) implementation, remove it entirely replacing with
much simpler code.
-mi
--- src/rdist.c Mon Nov 9 23:13:50 1998
+++ src/rdist.c Tue Jan 18 15:36:30 2005
@@ -113,5 +113,5 @@
* things in msgparseopts() need progname set.
*/
- setprogname(argv);
+ progname = basename(argv[0]);
if (cp = msgparseopts(localmsglist, TRUE)) {
--- src/common.c Mon Nov 9 23:09:01 1998
+++ src/common.c Tue Jan 18 15:40:19 2005
@@ -109,19 +109,4 @@
/*
- * Set program name
- */
-extern void setprogname(argv)
- char **argv;
-{
- register char *cp;
-
- if (!progname) {
- progname = strdup(argv[0]);
- if (cp = strrchr(progname, '/'))
- progname = cp + 1;
- }
-}
-
-/*
* Do run-time initialization
*/
@@ -138,5 +123,6 @@
(void) signal(SIGSEGV, sighandler);
- setprogname(argv);
+ if (progname == NULL)
+ progname = basename(argv[0]);
/*