diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-07-30 21:07:23 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-07-30 21:07:23 +0000 |
commit | 56dd5dfff4801fd32232df4fdb5ca24db2499825 (patch) | |
tree | 9998868fc401abf551c4f6d1d96067dff35d332b | |
parent | 3eb77bf53fcb0d783ad2c4d4a676378eeb2452a1 (diff) |
Sync OpenBSD patchset 206:
Don't babysit people and let them try to load /dev/zero or (more useful)
/dev/null if they want.
-rw-r--r-- | cfg.c | 12 | ||||
-rw-r--r-- | cmd-load-buffer.c | 6 |
2 files changed, 2 insertions, 16 deletions
@@ -1,4 +1,4 @@ -/* $Id: cfg.c,v 1.18 2009-06-25 16:21:32 nicm Exp $ */ +/* $Id: cfg.c,v 1.19 2009-07-30 21:07:23 tcunha Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -55,21 +55,11 @@ load_cfg(const char *path, char **cause) { FILE *f; u_int n; - struct stat sb; char *buf, *line, *ptr; size_t len; struct cmd_list *cmdlist; struct cmd_ctx ctx; - if (stat(path, &sb) != 0) { - xasprintf(cause, "%s: %s", path, strerror(errno)); - return (-1); - } - if (!S_ISREG(sb.st_mode)) { - xasprintf(cause, "%s: not a regular file", path); - return (-1); - } - if ((f = fopen(path, "rb")) == NULL) { xasprintf(cause, "%s: %s", path, strerror(errno)); return (1); diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c index d329ef94..99cd1f00 100644 --- a/cmd-load-buffer.c +++ b/cmd-load-buffer.c @@ -1,4 +1,4 @@ -/* $Id: cmd-load-buffer.c,v 1.8 2009-07-28 22:12:16 tcunha Exp $ */ +/* $Id: cmd-load-buffer.c,v 1.9 2009-07-30 21:07:23 tcunha Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -60,10 +60,6 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) ctx->error(ctx, "%s: %s", data->arg, strerror(errno)); return (-1); } - if (!S_ISREG(statbuf.st_mode)) { - ctx->error(ctx, "%s: not a regular file", data->arg); - return (-1); - } if ((f = fopen(data->arg, "rb")) == NULL) { ctx->error(ctx, "%s: %s", data->arg, strerror(errno)); |