Skip to content

Instantly share code, notes, and snippets.

@agentzh

agentzh/a.patch Secret

Created February 2, 2021 21:17
Show Gist options
  • Save agentzh/9e4efc6c21d25accfa1c541c4cf641a6 to your computer and use it in GitHub Desktop.
Save agentzh/9e4efc6c21d25accfa1c541c4cf641a6 to your computer and use it in GitHub Desktop.
diff --git a/staprun/staprun.c b/staprun/staprun.c
index 523eb861e..794700a07 100644
--- a/staprun/staprun.c
+++ b/staprun/staprun.c
@@ -242,7 +242,11 @@ static void remove_all_modules(void)
static int remove_module(const char *name, int verb)
{
- int ret;
+ int i, ret;
+ enum {
+ MAX_EINTR_TRIES = 5
+ };
+
dbug(2, "%s\n", name);
#ifdef PR_SET_NAME
@@ -271,7 +275,13 @@ static int remove_module(const char *name, int verb)
dbug(2, "removing module %s\n", name);
PROBE1(staprun, remove__module, name);
- ret = delete_module (name, O_NONBLOCK);
+
+ for (i = 0; i < MAX_EINTR_TRIES; i++) {
+ ret = delete_module (name, O_NONBLOCK);
+ if (ret == 0 || errno != EINTR)
+ break;
+ }
+
if (ret != 0) {
/* XXX: maybe we should just accept this, with a
diagnostic, but without an error. Might it be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment