diff options
| author | David <dbphillipsnz@gmail.com> | 2014-07-25 22:11:01 +1200 | 
|---|---|---|
| committer | David <dbphillipsnz@gmail.com> | 2014-07-25 22:11:01 +1200 | 
| commit | 4297d84d20dee84620e600a29bfa24572677cf05 (patch) | |
| tree | c138d20b170beebc2b65619992e0b57282c40d5a /getcore.c | |
| parent | 42d79b75c81f6d25293c02eab71e3437d9d892b5 (diff) | |
| download | paramano-4297d84d20dee84620e600a29bfa24572677cf05.tar.xz | |
Moved from sprintf to asprintf
Diffstat (limited to 'getcore.c')
| -rw-r--r-- | getcore.c | 11 | 
1 files changed, 6 insertions, 5 deletions
| @@ -33,12 +33,13 @@ unsigned int cores;   **********************************************************************/  bool core_exists(unsigned int core)  { -	FILE* fd; -	char path[128]; - -	sprintf(path, "/sys/devices/system/cpu/cpu%d/cpufreq", core); +	char* path; +	int result; +	asprintf(&path, "/sys/devices/system/cpu/cpu%d/cpufreq", core);  	debug("Checking if core %d exists by opening '%s'\n",core,path); -	return (access(path, F_OK) != -1); +	result = access(path, F_OK); +	free (path); +	return (result != -1);   } | 
