summaryrefslogtreecommitdiff
path: root/sys.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2008-01-28 15:54:55 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2008-01-28 15:54:55 -0800
commit673fd4184c005909db20035006f6b98eb6210bd4 (patch)
tree1b241751de4cd0b7768d6ad086d90355fafaba8f /sys.c
parent9ca1cdabb4f04cc7e8c437b48821f0672f58af60 (diff)
Replace malloc/strcpy pairs with strdup
Diffstat (limited to 'sys.c')
-rw-r--r--sys.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys.c b/sys.c
index b7535c4..efec546 100644
--- a/sys.c
+++ b/sys.c
@@ -361,12 +361,11 @@ allocatePty(int *pty_return, char **line_return)
close(pty);
goto bsd;
}
- line = malloc(strlen(temp_line) + 1);
+ line = strdup(temp_line);
if(!line) {
close(pty);
return -1;
}
- strcpy(line, temp_line);
fix_pty_perms(line);
@@ -394,8 +393,9 @@ allocatePty(int *pty_return, char **line_return)
goto bail;
found:
- line = malloc(strlen(name) + 1);
- strcpy(line, name);
+ line = strdup(name);
+ if(!line)
+ goto bail;
line[5] = 't';
fix_pty_perms(line);
*pty_return = pty;