On Ubuntu karmic compilation you may get errors as following and let us see how to fix it,
In file included from /usr/include/fcntl.h:217,
from cpm.h:35,
from security.c:27:
In function ‘open’,
inlined from ‘initSecurity’ at security.c:498:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make: *** [security.o] Error 1
As usual, the above message clearly states the issue with the code — error: open with O_CREAT in second argument needs 3 arguments
Solution is to edit line 498 of security.c and edited the line
canary = open(“/dev/null”, O_CREAT);
to reflect
canary = open(“/dev/null”, O_CREAT, 0666);
I had to edit this file to get cpm working on my local machine with Ubuntu Karmic installed.