| 926 | | size_t aBundlePathCLength = |
| 927 | | CFStringGetMaximumSizeForEncoding(CFStringGetLength(aBundlePathString), kCFStringEncodingUTF8) + 1; |
| 928 | | char *aBundlePath = (char *)malloc(aBundlePathCLength); |
| 929 | | char anExecutable[PATH_MAX] = ""; |
| 930 | | |
| 931 | | if (!aBundlePath) { |
| 932 | | syslog(LOG_EMERG, "malloc() failed; out of memory while running item %s", aBundlePathString); |
| 933 | | return (anError); |
| 934 | | } |
| 935 | | if (!CFStringGetCString(aBundlePathString, aBundlePath, aBundlePathCLength, kCFStringEncodingUTF8)) { |
| | 926 | char aBundlePath[PATH_MAX]; |
| | 927 | char anExecutable[PATH_MAX]; |
| | 928 | char *tmp; |
| | 929 | |
| | 930 | if (!CFStringGetCString(aBundlePathString, aBundlePath, sizeof(aBundlePath), kCFStringEncodingUTF8)) { |
| 940 | | { |
| 941 | | char *tmp; |
| 942 | | strncpy(anExecutable, aBundlePath, sizeof(anExecutable)); /* .../foo */ |
| 943 | | tmp = rindex(anExecutable, '/'); /* /foo */ |
| 944 | | strncat(anExecutable, tmp, strlen(tmp)); /* .../foo/foo */ |
| 945 | | } |
| 946 | | |
| 947 | | free(aBundlePath); |
| | 935 | tmp = rindex(aBundlePath, '/'); |
| | 936 | snprintf(anExecutable, sizeof(anExecutable), "%s%s", aBundlePath, tmp); |