I am executing "codesign -dvv " command through popen. which opens a bidriectional pipe to the child process ( child process for codesign -dvvvv ). when i try reading from the pipe, the output of the command, it reads 0 bytes. following is the code:
\#define MAX_BUF_SIZE 1024
\#define MAX_HASH_SIZE 1024
snprintf(command, MAX_BUF_SIZE,"codesign -dvv %s", file);
hash = (char *) malloc(MAX_HASH_SIZE);
if (NULL == hash) {
return NULL;
}
if (!(hfile = popen(command, "r"))){
return NULL;
}
while (fgets(temp, MAX_BUF_SIZE, hfile)!=NULL);
printf("sign %lu %s \n",strlen(temp),temp);
strcpy(hash,temp);
pclose(hfile);
In the output i can see the output of codesign command but my program cannot read it.