Skip to content

Commit ba78f4c

Browse files
committed
Solve errors/warnings given by clang (issue #282)
1 parent e6f6681 commit ba78f4c

File tree

6 files changed

+26
-14
lines changed

6 files changed

+26
-14
lines changed

atopsar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct pridef {
8585
char wanted; /* selected option (boolean) */
8686
char *cntcat; /* used categories of counters */
8787
char flag; /* flag on command line */
88-
void (*prihead)(); /* print header of list */
88+
void (*prihead)(int, int, int); /* print header of list */
8989
int (*priline)(struct sstat *, struct tstat *, struct tstat **,
9090
int, time_t, time_t, time_t,
9191
int, int, int, char *,

drawbar.c

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
// the other.
104104
/////////////////////////////////////////////////////////////////////////////
105105

106+
#include <sys/types.h>
106107
#include <curses.h>
107108
#include <locale.h>
108109
#include <string.h>

photoproc.c

+20-10
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,22 @@ photoproc(struct tstat *tasklist, int maxtask)
207207

208208
if ( !procstat(curtask, bootepoch, 1)) /* from /proc/pid/stat */
209209
{
210-
if ( chdir("..") == -1);
210+
if ( chdir("..") == -1)
211+
;
211212
continue;
212213
}
213214

214215
if ( !procstatus(curtask) ) /* from /proc/pid/status */
215216
{
216-
if ( chdir("..") == -1);
217+
if ( chdir("..") == -1)
218+
;
217219
continue;
218220
}
219221

220222
if ( !procio(curtask) ) /* from /proc/pid/io */
221223
{
222-
if ( chdir("..") == -1);
224+
if ( chdir("..") == -1)
225+
;
223226
continue;
224227
}
225228

@@ -316,7 +319,8 @@ photoproc(struct tstat *tasklist, int maxtask)
316319
*/
317320
if( dirtask == NULL )
318321
{
319-
if(chdir("../..") == -1);
322+
if(chdir("../..") == -1)
323+
;
320324
continue;
321325
}
322326

@@ -333,19 +337,22 @@ photoproc(struct tstat *tasklist, int maxtask)
333337

334338
if ( !procstat(curthr, bootepoch, 0))
335339
{
336-
if ( chdir("..") == -1);
340+
if ( chdir("..") == -1)
341+
;
337342
continue;
338343
}
339344

340345
if ( !procstatus(curthr) )
341346
{
342-
if ( chdir("..") == -1);
347+
if ( chdir("..") == -1)
348+
;
343349
continue;
344350
}
345351

346352
if ( !procio(curthr) )
347353
{
348-
if ( chdir("..") == -1);
354+
if ( chdir("..") == -1)
355+
;
349356
continue;
350357
}
351358

@@ -401,18 +408,21 @@ photoproc(struct tstat *tasklist, int maxtask)
401408
tval++; /* increment thread-level */
402409
cur_nth++; /* increment # threads */
403410

404-
if ( chdir("..") == -1); /* thread */
411+
if ( chdir("..") == -1)
412+
; /* thread */
405413
}
406414

407415
closedir(dirtask);
408-
if ( chdir("..") == -1); /* leave task */
416+
if ( chdir("..") == -1)
417+
; /* leave task */
409418

410419
// calibrate number of threads
411420
curtask->gen.nthr = cur_nth;
412421
}
413422
}
414423

415-
if ( chdir("..") == -1); /* leave process-level directry */
424+
if ( chdir("..") == -1)
425+
; /* leave process-level directry */
416426
}
417427

418428
closedir(dirp);

photosyst.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ struct perllc {
433433
};
434434

435435
struct llcstat {
436-
unsigned char nrllcs; // total number of LLC
436+
int nrllcs; // total number of LLC
437437
struct perllc perllc[MAXLLC];
438438
};
439439

utsnames.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ resetutsname(void)
193193

194194
regainrootprivs();
195195

196-
if (setns(mypidfd, CLONE_NEWUTS) == -1);
196+
if (setns(mypidfd, CLONE_NEWUTS) == -1)
197+
;
197198

198199
if (! droprootprivs())
199200
mcleanstop(42, "failed to drop root privs\n");

various.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include <stdarg.h>
4545
#include <string.h>
4646
#include <fcntl.h>
47-
#include <wait.h>
47+
#include <sys/wait.h>
4848
#include <unistd.h>
4949

5050
#include "atop.h"

0 commit comments

Comments
 (0)