Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F2825056
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/agents/virt/server/uuid-test.c b/agents/virt/server/uuid-test.c
index 57d946f4..3116ef93 100644
--- a/agents/virt/server/uuid-test.c
+++ b/agents/virt/server/uuid-test.c
@@ -1,64 +1,66 @@
#include "config.h"
#include <uuid/uuid.h>
#include <errno.h>
#include <string.h>
#include "uuid-test.h"
int
is_uuid(const char *value)
{
uuid_t id;
char test_value[37];
if (strlen(value) < 36) {
return 0;
}
+ memset(id, 0, sizeof(uuid_t));
+
if (uuid_is_null(id) < 0) {
errno = EINVAL;
return -1;
}
if (uuid_parse(value, id) < 0) {
return 0;
}
memset(test_value, 0, sizeof(test_value));
uuid_unparse(id, test_value);
if (strcasecmp(value, test_value)) {
return 0;
}
return 1;
}
#ifdef STANDALONE
#include <stdio.h>
int
main(int argc, char **argv)
{
int ret;
if (argc < 2) {
printf("Usage: uuidtest <value>\n");
return 1;
}
ret = is_uuid(argv[1]);
if (ret == 0) {
printf("%s is NOT a uuid\n", argv[1]);
} else if (ret == 1) {
printf("%s is a uuid\n", argv[1]);
} else {
printf("Error: %s\n", strerror(errno));
return 1;
}
return 0;
}
#endif
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jan 25, 11:19 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1322327
Default Alt Text
(1 KB)
Attached To
Mode
rF Fence Agents
Attached
Detach File
Event Timeline
Log In to Comment