Revert "tinycompress: Fix error handling in plugins."

This reverts commit f86d1a2e03fcc6876d7f0e27e2a2f394963b7ae2.

Reason for revert: b/177399104

Change-Id: I672a5f667918df3d2ffdf43cd152d710c7806555
diff --git a/compress_plugin.c b/compress_plugin.c
index 24d72ee..d445ae9 100644
--- a/compress_plugin.c
+++ b/compress_plugin.c
@@ -1,6 +1,6 @@
 /* compress_plugin.c
 **
-** Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+** Copyright (c) 2019, The Linux Foundation. All rights reserved.
 **
 ** Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
@@ -333,9 +333,10 @@
 			unsigned int flags, void **data, void *node)
 {
 	struct compress_plug_data *plug_data;
+	const char *err = NULL;
 	void *dl_hdl;
 	int rc = 0;
-	char *so_name, *open_fn, token[80], *name, *token_saveptr;
+	char *so_name, *open_fn, token[80], *name;
 
 	plug_data = calloc(1, sizeof(*plug_data));
 	if (!plug_data) {
@@ -360,25 +361,22 @@
 	}
 
 	sscanf(so_name, "lib%s", token);
-	token_saveptr = token;
-	name = strtok_r(token, ".", &token_saveptr);
-	if (!name) {
-		fprintf(stderr, "%s: invalid library name\n", __func__);
-		goto err_open_fn;
-	}
+	name = strtok(token, ".");
 	open_fn = calloc(1, strlen(name) + strlen("_open") + 1);
 	if (!open_fn) {
 		rc = -ENOMEM;
 		goto err_open_fn;
 	}
 
-	strlcpy(open_fn, name, strlen(name) + 1);
-	strlcat(open_fn, "_open", strlen(name) + strlen("_open") + 1);
+	strncpy(open_fn, name, strlen(name) + 1);
+	strcat(open_fn, "_open");
 
 	plug_data->plugin_open_fn = dlsym(dl_hdl, open_fn);
-	if (!plug_data->plugin_open_fn) {
+	err = dlerror();
+
+	if (err) {
 		fprintf(stderr, "%s: dlsym to open fn failed, err = '%s'\n",
-				__func__, dlerror());
+				__func__, err);
 		goto err_dlsym;
 	}