perror ("malloc");
exit (1);
}
- if (sscanf (line, "%*d: %*x:%x %64[0-9A-Fa-f]:%x %*x %*x:%*x %*x:%*x %*x %*d %*d "
#ifdef INO_T_IS_LONG_LONG
- "%Ld", &new->lcl_port, rmt_addr, &new->rmt_port,
+ if (sscanf (line, "%*d: %*x:%x %64[0-9A-Fa-f]:%x %*x %*x:%*x %*x:%*x %*x %*d %*d %Ld", &new->lcl_port, rmt_addr, &new->rmt_port,
#elif defined(INO_T_IS_INT)
- "%d", &new->lcl_port, rmt_addr, &new->rmt_port,
+ if (sscanf (line, "%*d: %*x:%x %64[0-9A-Fa-f]:%x %*x %*x:%*x %*x:%*x %*x %*d %*d %d", &new->lcl_port, rmt_addr, &new->rmt_port,
#else
- "%d", &new->lcl_port, rmt_addr, &new->rmt_port,
+ if (sscanf (line, "%*d: %*x:%x %64[0-9A-Fa-f]:%x %*x %*x:%*x %*x:%*x %*x %*d %*d %d", &new->lcl_port, rmt_addr, &new->rmt_port,
#endif
&new->ino) != 4)
{
}
empty = 1;
while ((de = readdir (dir)) != NULL)
- if ((pid = atoi (de->d_name)) != 0)
+ if ((pid = (pid_t)atoi (de->d_name)) != 0)
{
empty = 0;
if (asprintf (&path, "%s/%d", PROC_BASE, pid) < 0)
const struct passwd *pw;
const char *user, *scan;
char tmp[10], *path, comm[COMM_LEN + 1];
- int length, header, first, dummy;
+ int length, header, first, dummy, last_namelen = 0;
header = 1;
for (file = files; file; file = file->next)
if (file->name && (file->items || all))
header = 0;
}
length = 0;
- for (scan = file->name; *scan; scan++)
+ for (scan = file->name; scan && *scan; scan++)
if (*scan == '\\')
length += printf ("\\\\");
else if (*scan > ' ' && *scan <= '~')
length += printf ("\\%03o", *scan);
if (file->name_space)
length += printf ("/%s", file->name_space->name);
+
+ if (length > 0)
+ last_namelen=length;
+ else
+ printf("\n%*.*s",last_namelen,last_namelen," ");
+
if (!(file->flags & FLAG_VERB))
{
putchar (':');
rv = security_sid_to_context((int)sid, buf, &len);
if ( rv ) {
- out_string("`??'"); /* punt */
+ out_string("`??\'"); /* punt */
}
else {
out_string("`");
out_string(buf);
- out_string("'");
+ out_string("\'");
}
}
#endif /*FLASK_LINUX*/
len = 0;
for (here = current->argv[i]; *here; here++)
len += *here > ' ' && *here <= '~' ? 1 : 4;
- if (cur_x + len <= output_width - (i == current->argc - 1 ? 0 : 4))
+ if (cur_x + len <= output_width - (i == current->argc - 1 ? 0 : 4) || !trunc)
for (here = current->argv[i]; *here; here++)
if (*here > ' ' && *here <= '~')
out_char (*here);
}
empty = 1;
while ((de = readdir (dir)) != NULL)
- if ((pid = atoi (de->d_name)) != 0)
+ if ((pid = (pid_t) atoi (de->d_name)) != 0)
{
if (!(path = malloc (strlen (PROC_BASE) + strlen (de->d_name) + 10)))
exit (2);
if (fscanf
(file, "%d (%s) %c %d", &dummy, comm, (char *) &dummy,
&ppid) == 4)
- */
+ */
if (!print_args)
#ifdef FLASK_LINUX
add_proc(comm, pid, ppid, st.st_uid, NULL, 0, sid);
if (optind == argc - 1) {
if (isdigit (*argv[optind]))
{
- if (!(pid = atoi (argv[optind++])))
+ if (!(pid = (pid_t) atoi (argv[optind++])))
usage ();
}
else if (!(pw = getpwnam (argv[optind++])))