this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix xcselect corner case...

When /usr/libexec/DeveloperTools dir exists,
but doesn't have requested tool

authored by

Viktor Oreshkin and committed by
Viktor Oreshkin
7a8a5b6e e34f7a98

+19 -14
+19 -14
src/xcselect/xcselect.c
··· 253 253 dev_dir, buf, strerror(errno)); 254 254 } 255 255 } 256 - else if (dir_exists("/usr/libexec/DeveloperTools") && tool != NULL) 256 + else 257 257 { 258 - char* buf = __builtin_alloca(strlen(tool) + 30); 259 - strcpy(buf, "/usr/libexec/DeveloperTools/"); 260 - strcat(buf, tool); 258 + if (dir_exists("/usr/libexec/DeveloperTools") && tool != NULL) 259 + { 260 + char* buf = __builtin_alloca(strlen(tool) + 30); 261 + strcpy(buf, "/usr/libexec/DeveloperTools/"); 262 + strcat(buf, tool); 263 + 264 + if (access(buf, F_OK) == 0) 265 + { 266 + char** argv2 = (char **) __builtin_alloca((argc+1+1) * sizeof(char*)); 267 + argv2[0] = buf; 268 + for (int i = 0; i < argc; i++) 269 + argv2[i+1] = argv[i]; 270 + argv2[argc+1] = NULL; 261 271 262 - char** argv2 = (char **) __builtin_alloca((argc+1+1) * sizeof(char*)); 263 - argv2[0] = buf; 264 - for (int i = 0; i < argc; i++) 265 - argv2[i+1] = argv[i]; 266 - argv2[argc+1] = NULL; 272 + execv(buf, argv2); 273 + fprintf(stderr, "xcrun: failed to exec '%s': %s\n", buf, strerror(errno)); 274 + exit(1); 275 + } 276 + } 267 277 268 - execv(buf, argv2); 269 - fprintf(stderr, "xcrun: failed to exec '%s': %s\n", buf, strerror(errno)); 270 - } 271 - else 272 - { 273 278 fprintf(stderr, "xcrun: cannot find developer tools, set DEVELOPER_DIR if you are using a non-standard location.\n"); 274 279 } 275 280