=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rdist/docmd.c,v retrieving revision 1.12 retrieving revision 1.13 diff -c -r1.12 -r1.13 *** src/usr.bin/rdist/docmd.c 2003/04/05 20:31:58 1.12 --- src/usr.bin/rdist/docmd.c 2003/04/19 17:22:29 1.13 *************** *** 1,4 **** ! /* $OpenBSD: docmd.c,v 1.12 2003/04/05 20:31:58 deraadt Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: docmd.c,v 1.13 2003/04/19 17:22:29 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. *************** *** 39,45 **** "$From: docmd.c,v 6.86 1996/01/30 02:29:43 mcooper Exp $"; #else static char RCSid[] = ! "$OpenBSD: docmd.c,v 1.12 2003/04/05 20:31:58 deraadt Exp $"; #endif static char sccsid[] = "@(#)docmd.c 5.1 (Berkeley) 6/6/85"; --- 39,45 ---- "$From: docmd.c,v 6.86 1996/01/30 02:29:43 mcooper Exp $"; #else static char RCSid[] = ! "$OpenBSD: docmd.c,v 1.13 2003/04/19 17:22:29 millert Exp $"; #endif static char sccsid[] = "@(#)docmd.c 5.1 (Berkeley) 6/6/85"; *************** *** 64,70 **** extern struct cmd *cmds; /* Initialized by yyparse() */ time_t lastmod; /* Last modify time */ ! extern char target[]; extern char *ptarget; extern int activechildren; extern int maxchildren; --- 64,70 ---- extern struct cmd *cmds; /* Initialized by yyparse() */ time_t lastmod; /* Last modify time */ ! extern char target[BUFSIZ]; extern char *ptarget; extern int activechildren; extern int maxchildren; *************** *** 690,696 **** * first time cmptime() is called? */ if (ptarget == NULL) { ! if (exptilde(target, name) == NULL) return; ptarget = name = target; while (*ptarget) --- 690,696 ---- * first time cmptime() is called? */ if (ptarget == NULL) { ! if (exptilde(target, name, sizeof(target)) == NULL) return; ptarget = name = target; while (*ptarget) *************** *** 721,732 **** E_LOCFILE, name, sc->sc_name); message(MT_CHANGE, "special \"%s\"", buf); if (*env) { ! int len = strlen(*env); ! *env = (char *) xrealloc(*env, len + ! strlen(name) + 2); ! *env[len] = CNULL; ! (void) strcat(*env, name); ! (void) strcat(*env, ":"); } if (IS_ON(options, DO_VERIFY)) continue; --- 721,730 ---- E_LOCFILE, name, sc->sc_name); message(MT_CHANGE, "special \"%s\"", buf); if (*env) { ! size_t len = strlen(*env) + strlen(name) + 2; ! *env = (char *) xrealloc(*env, len); ! (void) strlcat(*env, name, len); ! (void) strlcat(*env, ":", len); } if (IS_ON(options, DO_VERIFY)) continue; *************** *** 800,815 **** if (sc->sc_type == NOTIFY) notify(NULL, sc->sc_args, (time_t)lastmod); else if (sc->sc_type == CMDSPECIAL && env) { ! char *p; ! int len = strlen(env); ! ! env = xrealloc(env, ! len + strlen(sc->sc_name) + 2); ! env[len] = CNULL; ! if (*(p = &env[len - 1]) == ':') ! *p = CNULL; ! (void) strcat(env, "';"); ! (void) strcat(env, sc->sc_name); message(MT_CHANGE, "cmdspecial \"%s\"", env); if (!nflag && IS_OFF(options, DO_VERIFY)) runcommand(env); --- 798,810 ---- if (sc->sc_type == NOTIFY) notify(NULL, sc->sc_args, (time_t)lastmod); else if (sc->sc_type == CMDSPECIAL && env) { ! size_t len = strlen(env); ! if (env[len - 1] == ':') ! env[--len] = CNULL; ! len += 2 + strlen(sc->sc_name) + 1; ! env = xrealloc(env, len); ! (void) strlcat(env, "';", len); ! (void) strlcat(env, sc->sc_name, len); message(MT_CHANGE, "cmdspecial \"%s\"", env); if (!nflag && IS_OFF(options, DO_VERIFY)) runcommand(env);