summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron/crontab.c
diff options
context:
space:
mode:
authoravsm <avsm@openbsd.org>2004-06-22 03:15:33 +0000
committeravsm <avsm@openbsd.org>2004-06-22 03:15:33 +0000
commitf624271c64ac526751d2682607aa7a2d00f19b64 (patch)
treea44d50605ba415008ffa1df65ef2697c5427fcb3 /usr.sbin/cron/crontab.c
parentmore portable env passing tests (diff)
downloadwireguard-openbsd-f624271c64ac526751d2682607aa7a2d00f19b64.tar.xz
wireguard-openbsd-f624271c64ac526751d2682607aa7a2d00f19b64.zip
use snprintf(3) instead of home-grown glue_strings() function
millert@ ok
Diffstat (limited to 'usr.sbin/cron/crontab.c')
-rw-r--r--usr.sbin/cron/crontab.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c
index 02a9c99dabc..ba2b7688cdb 100644
--- a/usr.sbin/cron/crontab.c
+++ b/usr.sbin/cron/crontab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crontab.c,v 1.44 2004/06/17 22:11:55 millert Exp $ */
+/* $OpenBSD: crontab.c,v 1.45 2004/06/22 03:15:33 avsm Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@@ -22,7 +22,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char const rcsid[] = "$OpenBSD: crontab.c,v 1.44 2004/06/17 22:11:55 millert Exp $";
+static char const rcsid[] = "$OpenBSD: crontab.c,v 1.45 2004/06/22 03:15:33 avsm Exp $";
#endif
/* crontab - install and manage per-user crontab files
@@ -234,7 +234,7 @@ list_cmd(void) {
int ch;
log_it(RealUser, Pid, "LIST", User);
- if (!glue_strings(n, sizeof n, SPOOL_DIR, User, '/')) {
+ if (snprintf(n, sizeof n, "%s/%s", SPOOL_DIR, User) >= sizeof(n)) {
fprintf(stderr, "path too long\n");
exit(ERROR_EXIT);
}
@@ -259,7 +259,7 @@ delete_cmd(void) {
char n[MAX_FNAME];
log_it(RealUser, Pid, "DELETE", User);
- if (!glue_strings(n, sizeof n, SPOOL_DIR, User, '/')) {
+ if (snprintf(n, sizeof n, "%s/%s", SPOOL_DIR, User) >= sizeof(n)) {
fprintf(stderr, "path too long\n");
exit(ERROR_EXIT);
}
@@ -291,7 +291,7 @@ edit_cmd(void) {
PID_T pid, xpid;
log_it(RealUser, Pid, "BEGIN EDIT", User);
- if (!glue_strings(n, sizeof n, SPOOL_DIR, User, '/')) {
+ if (snprintf(n, sizeof n, "%s/%s", SPOOL_DIR, User) >= sizeof(n)) {
fprintf(stderr, "path too long\n");
exit(ERROR_EXIT);
}
@@ -321,8 +321,8 @@ edit_cmd(void) {
(void)signal(SIGINT, SIG_IGN);
(void)signal(SIGQUIT, SIG_IGN);
- if (!glue_strings(Filename, sizeof Filename, _PATH_TMP,
- "crontab.XXXXXXXXXX", '/')) {
+ if (snprintf(Filename, sizeof Filename, "%s/crontab.XXXXXXXXXX",
+ _PATH_TMP) >= sizeof(Filename)) {
fprintf(stderr, "path too long\n");
goto fatal;
}
@@ -400,7 +400,7 @@ edit_cmd(void) {
perror(_PATH_TMP);
exit(ERROR_EXIT);
}
- if (!glue_strings(q, sizeof q, editor, Filename, ' ')) {
+ if (snprintf(q, sizeof q, "%s %s", editor, Filename) >= sizeof(q)) {
fprintf(stderr, "%s: editor command line too long\n",
ProgramName);
exit(ERROR_EXIT);
@@ -508,8 +508,8 @@ replace_cmd(void) {
fprintf(stderr, "%s: Cannot allocate memory.\n", ProgramName);
return (-2);
}
- if (!glue_strings(TempFilename, sizeof TempFilename, SPOOL_DIR,
- "tmp.XXXXXXXXXX", '/')) {
+ if (snprintf(TempFilename, sizeof TempFilename, "%s/tmp.XXXXXXXXX", SPOOL_DIR) >=
+ sizeof(TempFilename)) {
TempFilename[0] = '\0';
fprintf(stderr, "path too long\n");
return (-2);
@@ -611,7 +611,7 @@ replace_cmd(void) {
goto done;
}
- if (!glue_strings(n, sizeof n, SPOOL_DIR, User, '/')) {
+ if (snprintf(n, sizeof n, "%s/%s", SPOOL_DIR, User) >= sizeof(n)) {
fprintf(stderr, "path too long\n");
error = -2;
goto done;