Unifies and fixes malloc and strdup calls. Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- term-utils/agetty.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 57d1980..0609bc5 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -36,6 +36,7 @@ #include "nls.h" #include "pathnames.h" #include "c.h" +#include "xalloc.h" #ifdef __linux__ #include <sys/param.h> @@ -384,10 +385,7 @@ parse_args(argc, argv, op) op->eightbits = 1; break; case 'I': - if (!(op->initstring = malloc(strlen(optarg)+1))) { - error(_("can't malloc initstring")); - break; - } + op->initstring = xmalloc(strlen(optarg) + 1); { char ch, *p, *q; int i; @@ -500,7 +498,7 @@ parse_args(argc, argv, op) strcpy(dev_name, "/dev/tts/"); strcat(dev_name, op->tty + 4); if (stat(dev_name, &st) == 0) - op->tty = strdup(dev_name + 5); + op->tty = xstrdup(dev_name + 5); } } else if (strncmp(op->tty, "tty", 3) == 0) { strcpy(dev_name, "/dev/"); @@ -509,7 +507,7 @@ parse_args(argc, argv, op) strcpy(dev_name, "/dev/vc/"); strcat(dev_name, op->tty + 3); if (stat(dev_name, &st) == 0) - op->tty = strdup(dev_name + 5); + op->tty = xstrdup(dev_name + 5); } } } -- 1.7.4.4 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html