summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/strsep.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/lib/strsep.c')
-rw-r--r--mdk-stage1/dietlibc/lib/strsep.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mdk-stage1/dietlibc/lib/strsep.c b/mdk-stage1/dietlibc/lib/strsep.c
index a1bf1872a..db76f89b5 100644
--- a/mdk-stage1/dietlibc/lib/strsep.c
+++ b/mdk-stage1/dietlibc/lib/strsep.c
@@ -4,6 +4,7 @@ char *strsep(char **stringp, const char *delim) {
register char *tmp=*stringp;
register char *tmp2=tmp;
register const char *tmp3;
+ if (!*stringp) return 0;
for (tmp2=tmp; *tmp2; ++tmp2) {
for (tmp3=delim; *tmp3; ++tmp3)
if (*tmp2==*tmp3) { /* delimiter found */
@@ -12,5 +13,6 @@ char *strsep(char **stringp, const char *delim) {
return tmp;
}
}
- return 0;
+ *stringp=0;
+ return tmp;
}