diff options
Diffstat (limited to 'src/lib/libc/stdlib/putenv.c')
-rw-r--r-- | src/lib/libc/stdlib/putenv.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/lib/libc/stdlib/putenv.c b/src/lib/libc/stdlib/putenv.c index 2194c2c608..d8c4886d4b 100644 --- a/src/lib/libc/stdlib/putenv.c +++ b/src/lib/libc/stdlib/putenv.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /*- | 1 | /*- |
2 | * Copyright (c) 1988 The Regents of the University of California. | 2 | * Copyright (c) 1988, 1993 |
3 | * All rights reserved. | 3 | * The Regents of the University of California. All rights reserved. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
@@ -32,8 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | /*static char *sccsid = "from: @(#)putenv.c 5.4 (Berkeley) 2/23/91";*/ | 35 | static char *rcsid = "$OpenBSD: putenv.c,v 1.2 1996/08/10 05:03:00 tholo Exp $"; |
36 | static char *rcsid = "$Id: putenv.c,v 1.1.1.1 1995/10/18 08:42:18 deraadt Exp $"; | ||
37 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
38 | 37 | ||
39 | #include <stdlib.h> | 38 | #include <stdlib.h> |
@@ -43,17 +42,17 @@ int | |||
43 | putenv(str) | 42 | putenv(str) |
44 | const char *str; | 43 | const char *str; |
45 | { | 44 | { |
46 | register char *p, *equal; | 45 | char *p, *equal; |
47 | int rval; | 46 | int rval; |
48 | 47 | ||
49 | if (!(p = strdup(str))) | 48 | if ((p = strdup(str)) == NULL) |
50 | return(1); | 49 | return (-1); |
51 | if (!(equal = strchr(p, '='))) { | 50 | if ((equal = strchr(p, '=')) == NULL) { |
52 | (void)free(p); | 51 | (void)free(p); |
53 | return(1); | 52 | return (-1); |
54 | } | 53 | } |
55 | *equal = '\0'; | 54 | *equal = '\0'; |
56 | rval = setenv(p, equal + 1, 1); | 55 | rval = setenv(p, equal + 1, 1); |
57 | (void)free(p); | 56 | (void)free(p); |
58 | return(rval); | 57 | return (rval); |
59 | } | 58 | } |