warning directs users to the FAQ
This commit is contained in:
@@ -148,7 +148,7 @@ typedef union sel_union {
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
dev_t tty;
|
||||
char cmd[8]; /* this is _not_ \0 terminated */
|
||||
char cmd[16]; /* this is _not_ \0 terminated */
|
||||
} sel_union;
|
||||
|
||||
typedef struct selection_node {
|
||||
|
@@ -246,7 +246,6 @@ static void simple_spew(void){
|
||||
exit(1);
|
||||
}
|
||||
memset(&buf, '#', sizeof(proc_t));
|
||||
/* use "ps_" prefix to catch library mismatch */
|
||||
while(ps_readproc(ptp,&buf)){
|
||||
if(want_this_proc(&buf)) show_one_proc(&buf);
|
||||
if(buf.cmdline) free((void*)*buf.cmdline); // ought to reuse
|
||||
|
13
ps/parser.c
13
ps/parser.c
@@ -121,7 +121,7 @@ static const char *parse_gid(char *str, sel_union *ret){
|
||||
}
|
||||
|
||||
static const char *parse_cmd(char *str, sel_union *ret){
|
||||
strncpy(ret->cmd, str, 8); /* strncpy pads to end */
|
||||
strncpy(ret->cmd, str, sizeof ret->cmd); // strncpy pads to end
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1130,8 +1130,17 @@ try_bsd:
|
||||
err2 = select_bits_setup();
|
||||
if(err2) goto total_failure;
|
||||
|
||||
// Feel a need to patch this out? First of all, read the FAQ.
|
||||
// Second of all, talk to me. Without this warning, people can
|
||||
// get seriously confused. Ask yourself if users would freak out
|
||||
// about "ps -aux" suddenly changing behavior if a user "x" were
|
||||
// added to the system.
|
||||
if(!(personality & PER_FORCE_BSD))
|
||||
fprintf(stderr, "Bad syntax, perhaps a bogus '-'?\n");
|
||||
fprintf(stderr, "Warning: bad '-'? See http://procps.sf.net/faq.html\n");
|
||||
// Remember: contact albert@users.sf.net or procps-feedback@lists.sf.net
|
||||
// if you should feel tempted. Be damn sure you understand all
|
||||
// the issues. The same goes for other stuff too, BTW. Please ask.
|
||||
// I'm happy to justify various implementation choices.
|
||||
|
||||
choose_dimensions();
|
||||
return 0;
|
||||
|
@@ -106,9 +106,8 @@ static int proc_was_listed(proc_t *buf){
|
||||
break; case SEL_TTY : return_if_match(tty,tty);
|
||||
break; case SEL_SESS: return_if_match(session,pid);
|
||||
|
||||
/* TODO Should use a long long cast for performance */
|
||||
break; case SEL_COMM: i=sn->n; while(i--)
|
||||
if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 8 )) return 1;
|
||||
if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 15 )) return 1;
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user