+void ustcomm_fini_app(struct ustcomm_app *handle)
+{
+ int result;
+ struct stat st;
+
+ /* Destroy socket */
+ ERR("socket path is: %s", handle->server.socketpath);
+ result = stat(handle->server.socketpath, &st);
+ if(result == -1) {
+ PERROR("stat (%s)", handle->server.socketpath);
+ return;
+ }
+
+ /* Paranoid check before deleting. */
+ result = S_ISSOCK(st.st_mode);
+ if(!result) {
+ ERR("The socket we are about to delete is not a socket.");
+ return;
+ }
+
+ result = unlink(handle->server.socketpath);
+ if(result == -1) {
+ PERROR("unlink");
+ }
+}
+