From 4bff4d9d2bd1f63b83ac62fde89181a63bc059c1 Mon Sep 17 00:00:00 2001 From: wesommer Date: Sun, 2 Aug 1987 21:49:53 +0000 Subject: [PATCH] Prevent recursive query call. --- lib/mr_query.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/mr_query.c b/lib/mr_query.c index ab57d674..4418dbf8 100644 --- a/lib/mr_query.c +++ b/lib/mr_query.c @@ -6,9 +6,12 @@ * Copyright (C) 1987 by the Massachusetts Institute of Technology * * $Log$ - * Revision 1.2 1987-06-16 17:48:58 wesommer - * Clean up memory allocation, indenting. + * Revision 1.3 1987-08-02 21:49:53 wesommer + * Prevent recursive query call. * + * Revision 1.2 87/06/16 17:48:58 wesommer + * Clean up memory allocation, indenting. + * * Revision 1.1 87/06/04 01:29:32 wesommer * Initial revision * @@ -26,6 +29,7 @@ static char *rcsid_sms_query_c = "$Header$"; * It builds a new argument vector with the query handle prepended, * and calls sms_query_internal. */ +int level = 0; int sms_query(name, argc, argv, callproc, callarg) char *name; /* Query name */ @@ -66,6 +70,9 @@ int sms_query_internal(argc, argv, callproc, callarg) register sms_params *params = NULL; sms_params *reply = NULL; int stopcallbacks = 0; + + if (level) return SMS_QUERY_NOT_REENTRANT; + level++; CHECK_CONNECTED; @@ -92,12 +99,14 @@ int sms_query_internal(argc, argv, callproc, callarg) complete_operation(_sms_recv_op); if (OP_STATUS(_sms_recv_op) != OP_COMPLETE) { sms_disconnect(); - return SMS_ABORTED; + status = SMS_ABORTED; + goto punt_1; } } punt: sms_destroy_reply(reply); - +punt_1: + level--; return status; } /* -- 2.45.2