Skip to content

Commit

Permalink
Solve errors/warnings given by clang (issue #282)
Browse files Browse the repository at this point in the history
  • Loading branch information
Atoptool committed Jan 3, 2024
1 parent e6f6681 commit ba78f4c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion atopsar.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct pridef {
char wanted; /* selected option (boolean) */
char *cntcat; /* used categories of counters */
char flag; /* flag on command line */
void (*prihead)(); /* print header of list */
void (*prihead)(int, int, int); /* print header of list */
int (*priline)(struct sstat *, struct tstat *, struct tstat **,
int, time_t, time_t, time_t,
int, int, int, char *,
Expand Down
1 change: 1 addition & 0 deletions drawbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
// the other.
/////////////////////////////////////////////////////////////////////////////

#include <sys/types.h>
#include <curses.h>
#include <locale.h>
#include <string.h>
Expand Down
30 changes: 20 additions & 10 deletions photoproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,22 @@ photoproc(struct tstat *tasklist, int maxtask)

if ( !procstat(curtask, bootepoch, 1)) /* from /proc/pid/stat */
{
if ( chdir("..") == -1);
if ( chdir("..") == -1)
;
continue;
}

if ( !procstatus(curtask) ) /* from /proc/pid/status */
{
if ( chdir("..") == -1);
if ( chdir("..") == -1)
;
continue;
}

if ( !procio(curtask) ) /* from /proc/pid/io */
{
if ( chdir("..") == -1);
if ( chdir("..") == -1)
;
continue;
}

Expand Down Expand Up @@ -316,7 +319,8 @@ photoproc(struct tstat *tasklist, int maxtask)
*/
if( dirtask == NULL )
{
if(chdir("../..") == -1);
if(chdir("../..") == -1)
;
continue;
}

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

if ( !procstat(curthr, bootepoch, 0))
{
if ( chdir("..") == -1);
if ( chdir("..") == -1)
;
continue;
}

if ( !procstatus(curthr) )
{
if ( chdir("..") == -1);
if ( chdir("..") == -1)
;
continue;
}

if ( !procio(curthr) )
{
if ( chdir("..") == -1);
if ( chdir("..") == -1)
;
continue;
}

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

if ( chdir("..") == -1); /* thread */
if ( chdir("..") == -1)
; /* thread */
}

closedir(dirtask);
if ( chdir("..") == -1); /* leave task */
if ( chdir("..") == -1)
; /* leave task */

// calibrate number of threads
curtask->gen.nthr = cur_nth;
}
}

if ( chdir("..") == -1); /* leave process-level directry */
if ( chdir("..") == -1)
; /* leave process-level directry */
}

closedir(dirp);
Expand Down
2 changes: 1 addition & 1 deletion photosyst.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ struct perllc {
};

struct llcstat {
unsigned char nrllcs; // total number of LLC
int nrllcs; // total number of LLC
struct perllc perllc[MAXLLC];
};

Expand Down
3 changes: 2 additions & 1 deletion utsnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ resetutsname(void)

regainrootprivs();

if (setns(mypidfd, CLONE_NEWUTS) == -1);
if (setns(mypidfd, CLONE_NEWUTS) == -1)
;

if (! droprootprivs())
mcleanstop(42, "failed to drop root privs\n");
Expand Down
2 changes: 1 addition & 1 deletion various.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <stdarg.h>
#include <string.h>
#include <fcntl.h>
#include <wait.h>
#include <sys/wait.h>
#include <unistd.h>

#include "atop.h"
Expand Down

0 comments on commit ba78f4c

Please sign in to comment.