Skip to content

Commit

Permalink
lib/, src/: Remove useless casts in fgets(3)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar committed Jul 21, 2024
1 parent 4d66df6 commit 941c951
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions lib/commonio.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,8 @@ int commonio_open (struct commonio_db *db, int mode)
goto cleanup_errno;

len = strlen (buf);
if (db->ops->fgets (buf + len,
(int) (buflen - len),
db->fp) == NULL) {
if (db->ops->fgets(buf + len, buflen - len, db->fp) == NULL)
goto cleanup_buf;
}
}
stpsep(buf, "\n");

Expand Down
2 changes: 1 addition & 1 deletion lib/gshadow.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void endsgent (void)
buflen *= 2;

len = strlen (buf);
if (fgetsx(&buf[len], (int) (buflen - len), fp) == NULL)
if (fgetsx(&buf[len], buflen - len, fp) == NULL)
return NULL;
}
stpsep(buf, "\n");
Expand Down
2 changes: 1 addition & 1 deletion lib/setupenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void read_env_file (const char *filename)
if (NULL == fp) {
return;
}
while (fgets(buf, (int)(sizeof(buf)), fp) != NULL) {
while (fgets(buf, sizeof(buf), fp) != NULL) {
if (stpsep(buf, "\n") == NULL)
break;

Expand Down
2 changes: 1 addition & 1 deletion src/chgpasswd.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ int main (int argc, char **argv)
* group entry for each group will be looked up in the appropriate
* file (gshadow or group) and the password changed.
*/
while (fgets (buf, (int) sizeof buf, stdin) != NULL) {
while (fgets(buf, sizeof(buf), stdin) != NULL) {
line++;
if (stpsep(buf, "\n") == NULL) {
fprintf (stderr, _("%s: line %d: line too long\n"),
Expand Down

0 comments on commit 941c951

Please sign in to comment.