diff options
author | Theodore Ts'o <tytso@mit.edu> | 2007-12-17 15:26:47 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2007-12-17 15:26:47 -0500 |
commit | d37a4fa78806d9dd02586ef6696332ba944ae906 (patch) | |
tree | 13c27501cfc6625185915826d7cfbce801208a2f | |
parent | 9d8c203a462ee18c1fd09a68cfe0e2ec7d8288da (diff) | |
download | e2fsprogs-d37a4fa78806d9dd02586ef6696332ba944ae906.tar.gz |
libuuid: Only try to start the uuidd daemon a limited number of times
If we fail to create the uuidd daemon after 5 or 6 tries, another
10,000 tries probably won't be successful.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | lib/uuid/gen_uuid.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/uuid/gen_uuid.c b/lib/uuid/gen_uuid.c index 1918b3bf..397a2073 100644 --- a/lib/uuid/gen_uuid.c +++ b/lib/uuid/gen_uuid.c @@ -394,6 +394,7 @@ static int get_uuid_via_daemon(int op, uuid_t out, int *num) pid_t pid; static const char *uuidd_path = UUIDD_PATH; static int access_ret = -2; + static int start_attempts = 0; if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) return -1; @@ -405,7 +406,7 @@ static int get_uuid_via_daemon(int op, uuid_t out, int *num) sizeof(struct sockaddr_un)) < 0) { if (access_ret == -2) access_ret = access(uuidd_path, X_OK); - if (access_ret == 0) { + if (access_ret == 0 && start_attempts++ < 5) { if ((pid = fork()) == 0) { execl(uuidd_path, "uuidd", "-qT", "300", 0); exit(1); |