From 459211f90c3beee5aa5b189f90b4e97c680cdb3e Mon Sep 17 00:00:00 2001
Message-Id: <459211f90c3beee5aa5b189f90b4e97c680cdb3e.1367947969.git.minovotn@redhat.com>
In-Reply-To: <707b9b97153063374d2530e72c49b1499fc21af9.1367947969.git.minovotn@redhat.com>
References: <707b9b97153063374d2530e72c49b1499fc21af9.1367947969.git.minovotn@redhat.com>
From: Michal Novotny <minovotn@redhat.com>
Date: Tue, 7 May 2013 18:35:55 +0200
Subject: [PATCH 002/114] Revert "qemu-ga: ga_get_fd_handle(): abort if
 fd_counter overflows"

This reverts commit eed13735cde3480817d45445b8786bb1a17c6c31.

Reverting as asked by Laszlo in message <51892739.2030807@redhat.com>
because of the ordering issue (most likely) related to supersed
testing.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 qemu-ga.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/qemu-ga.c b/qemu-ga.c
index 2336ba9..5d19991 100644
--- a/qemu-ga.c
+++ b/qemu-ga.c
@@ -889,13 +889,9 @@ int64_t ga_get_fd_handle(GAState *s, Error **errp)
     g_assert(!ga_is_frozen(s));
 
     handle = s->pstate.fd_counter++;
-
-    /* This should never happen on a reasonable timeframe, as guest-file-open
-     * would have to be issued 2^63 times */
-    if (s->pstate.fd_counter == INT64_MAX) {
-        abort();
+    if (s->pstate.fd_counter < 0) {
+        s->pstate.fd_counter = 0;
     }
-
     if (!write_persistent_state(&s->pstate, s->pstate_filepath)) {
         error_setg(errp, "failed to commit persistent state to disk");
     }
-- 
1.7.11.7

