aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--miscutils/devfsd.c4
-rw-r--r--miscutils/hdparm.c2
-rw-r--r--miscutils/less.c11
3 files changed, 9 insertions, 8 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index d57691414..e6f01eb6a 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -1016,9 +1016,9 @@ static void restore(char *spath, struct stat source_stat, int rootlen)
1016 dest_stat.st_mode = 0; 1016 dest_stat.st_mode = 0;
1017 dpath = concat_path_file(mount_point, spath + rootlen); 1017 dpath = concat_path_file(mount_point, spath + rootlen);
1018 lstat(dpath, &dest_stat); 1018 lstat(dpath, &dest_stat);
1019 free(dpath);
1020 if (S_ISLNK(source_stat.st_mode) || (source_stat.st_mode & S_ISVTX)) 1019 if (S_ISLNK(source_stat.st_mode) || (source_stat.st_mode & S_ISVTX))
1021 copy_inode(dpath, &dest_stat, (source_stat.st_mode & ~S_ISVTX), spath, &source_stat); 1020 copy_inode(dpath, &dest_stat, (source_stat.st_mode & ~S_ISVTX), spath, &source_stat);
1021 free(dpath);
1022 1022
1023 if (S_ISDIR(source_stat.st_mode)) 1023 if (S_ISDIR(source_stat.st_mode))
1024 dir_operation(RESTORE, spath, rootlen, NULL); 1024 dir_operation(RESTORE, spath, rootlen, NULL);
@@ -1271,7 +1271,7 @@ static void dir_operation(int type, const char * dir_name, int var, unsigned lon
1271 1271
1272 while ((de = readdir(dp)) != NULL) { 1272 while ((de = readdir(dp)) != NULL) {
1273 1273
1274 if (de->d_name && DOT_OR_DOTDOT(de->d_name)) 1274 if (DOT_OR_DOTDOT(de->d_name))
1275 continue; 1275 continue;
1276 path = concat_path_file(dir_name, de->d_name); 1276 path = concat_path_file(dir_name, de->d_name);
1277 if (lstat(path, &statbuf) == 0) { 1277 if (lstat(path, &statbuf) == 0) {
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 8b844717f..e07ee6398 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -552,7 +552,7 @@ static void print_ascii(const char *p, int length)
552 552
553 length *= 2; 553 length *= 2;
554 /* find first non-space & print it */ 554 /* find first non-space & print it */
555 while (length && p[ofs] != ' ') { 555 while (length && p[ofs] == ' ') {
556 p++; 556 p++;
557 LE_ONLY(ofs = -ofs;) 557 LE_ONLY(ofs = -ofs;)
558 length--; 558 length--;
diff --git a/miscutils/less.c b/miscutils/less.c
index e81130988..521792f2e 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -477,7 +477,8 @@ static int at_end(void)
477 */ 477 */
478static void read_lines(void) 478static void read_lines(void)
479{ 479{
480 int ndelay_set, eagain, fdflags; 480 int ndelay_set, eagain;
481 int UNINITIALIZED_VAR(fdflags, fdflags);
481 char *current_line, *p; 482 char *current_line, *p;
482 int w = width; 483 int w = width;
483 char last_terminated = terminated; 484 char last_terminated = terminated;
@@ -509,16 +510,16 @@ static void read_lines(void)
509 // Consider these cases: 510 // Consider these cases:
510 // "less FILE": can set O_NONBLOCK on open. 511 // "less FILE": can set O_NONBLOCK on open.
511 // "true | less": can't. 512 // "true | less": can't.
512 // " { less; cat; } <FILE": can't. And must not confuse cat. 513 // "{ less; cat; } <FILE": can't. And must not confuse cat.
513 ndelay_set = -1; // "don't know whether stdin is nonblocking" 514 ndelay_set = -1; // "don't know whether stdin is nonblocking"
514 eagain = 0; 515 eagain = 0;
515 516
516 while (1) { /* read lines until we reach cur_fline or wanted_match */ 517 while (1) { // read lines until we reach cur_fline or wanted_match
517 *p = '\0'; 518 *p = '\0';
518 terminated = 0; 519 terminated = 0;
519 while (1) { /* read chars until we have a line */ 520 while (1) { // read chars until we have a line
520 char c; 521 char c;
521 /* if no unprocessed chars left, eat more */ 522 // if no unprocessed chars left, eat more
522 if (readpos >= read_size) { 523 if (readpos >= read_size) {
523 // Read stdin, temporarily make it nonblocking (if it's not already) 524 // Read stdin, temporarily make it nonblocking (if it's not already)
524 if (ndelay_set < 0) { 525 if (ndelay_set < 0) {