aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-27 15:11:13 -0500
committerTed Gould <ted@gould.cx>2012-08-27 15:11:13 -0500
commit252858fc2596efd3f076c352337893dd794de15f (patch)
tree03a7d059e312dce1e9f14aeb35d3b03af2d580ef
parent50bf385109f48196a4be34d3f4535e3b373cb9bf (diff)
downloadlibpam-freerdp2-252858fc2596efd3f076c352337893dd794de15f.tar.gz
libpam-freerdp2-252858fc2596efd3f076c352337893dd794de15f.tar.bz2
libpam-freerdp2-252858fc2596efd3f076c352337893dd794de15f.zip
Using 'strstr' instead our own loop.
-rw-r--r--src/pam-freerdp.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index 440ee40..0277e0c 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -92,13 +92,12 @@ get_item (pam_handle_t * pamh, int type)
if ((subloc = strstr(retval, "://")) != NULL) {
char * original = retval;
char * newish = retval + strlen("://");
- char * c;
- for (c = newish; *c != '\0'; c++) {
- if (*c == '/') {
- *c = '\0';
- break;
- }
+ char * c = strstr(newish, "/");
+
+ if (c != NULL) {
+ c[0] = '\0';
}
+
retval = strdup(newish);
free(original);
}