mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
Bug 591214 - Warnings building gcancellable.o
- check for EINTR on read() and write() calls - remove unused 'priv' variable
This commit is contained in:
parent
48e2a57043
commit
85501f5ffa
@ -24,6 +24,7 @@
|
|||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <gioerror.h>
|
#include <gioerror.h>
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
@ -226,7 +227,6 @@ set_fd_close_exec (int fd)
|
|||||||
static void
|
static void
|
||||||
g_cancellable_open_pipe (GCancellable *cancellable)
|
g_cancellable_open_pipe (GCancellable *cancellable)
|
||||||
{
|
{
|
||||||
const char ch = 'x';
|
|
||||||
GCancellablePrivate *priv;
|
GCancellablePrivate *priv;
|
||||||
|
|
||||||
priv = cancellable->priv;
|
priv = cancellable->priv;
|
||||||
@ -241,7 +241,14 @@ g_cancellable_open_pipe (GCancellable *cancellable)
|
|||||||
set_fd_close_exec (priv->cancel_pipe[1]);
|
set_fd_close_exec (priv->cancel_pipe[1]);
|
||||||
|
|
||||||
if (priv->cancelled)
|
if (priv->cancelled)
|
||||||
write (priv->cancel_pipe[1], &ch, 1);
|
{
|
||||||
|
const char ch = 'x';
|
||||||
|
gssize c;
|
||||||
|
|
||||||
|
do
|
||||||
|
c = write (priv->cancel_pipe[1], &ch, 1);
|
||||||
|
while (c == -1 && errno == EINTR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -368,8 +375,6 @@ g_cancellable_reset (GCancellable *cancellable)
|
|||||||
|
|
||||||
if (priv->cancelled)
|
if (priv->cancelled)
|
||||||
{
|
{
|
||||||
char ch;
|
|
||||||
|
|
||||||
/* Make sure we're not leaving old cancel state around */
|
/* Make sure we're not leaving old cancel state around */
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
@ -377,7 +382,15 @@ g_cancellable_reset (GCancellable *cancellable)
|
|||||||
ResetEvent (priv->event);
|
ResetEvent (priv->event);
|
||||||
#endif
|
#endif
|
||||||
if (priv->cancel_pipe[0] != -1)
|
if (priv->cancel_pipe[0] != -1)
|
||||||
read (priv->cancel_pipe[0], &ch, 1);
|
{
|
||||||
|
gssize c;
|
||||||
|
char ch;
|
||||||
|
|
||||||
|
do
|
||||||
|
c = read (priv->cancel_pipe[0], &ch, 1);
|
||||||
|
while (c == -1 && errno == EINTR);
|
||||||
|
}
|
||||||
|
|
||||||
priv->cancelled = FALSE;
|
priv->cancelled = FALSE;
|
||||||
}
|
}
|
||||||
G_UNLOCK(cancellable);
|
G_UNLOCK(cancellable);
|
||||||
@ -600,7 +613,6 @@ g_cancellable_release_fd (GCancellable *cancellable)
|
|||||||
void
|
void
|
||||||
g_cancellable_cancel (GCancellable *cancellable)
|
g_cancellable_cancel (GCancellable *cancellable)
|
||||||
{
|
{
|
||||||
const char ch = 'x';
|
|
||||||
gboolean cancel;
|
gboolean cancel;
|
||||||
GCancellablePrivate *priv;
|
GCancellablePrivate *priv;
|
||||||
|
|
||||||
@ -620,7 +632,14 @@ g_cancellable_cancel (GCancellable *cancellable)
|
|||||||
SetEvent (priv->event);
|
SetEvent (priv->event);
|
||||||
#endif
|
#endif
|
||||||
if (priv->cancel_pipe[1] != -1)
|
if (priv->cancel_pipe[1] != -1)
|
||||||
write (priv->cancel_pipe[1], &ch, 1);
|
{
|
||||||
|
const char ch = 'x';
|
||||||
|
gssize c;
|
||||||
|
|
||||||
|
do
|
||||||
|
c = write (priv->cancel_pipe[1], &ch, 1);
|
||||||
|
while (c == -1 && errno == EINTR);
|
||||||
|
}
|
||||||
G_UNLOCK(cancellable);
|
G_UNLOCK(cancellable);
|
||||||
|
|
||||||
if (cancel)
|
if (cancel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user