+++ b/sunrpc/rpc_main.c
@@ -958,9 +958,10 @@ mkfile_output (struct commandline *cmd)
abort ();
- temp = rindex (cmd->infile, '.');
+ temp = strrchr (cmd->infile, '.');
cp = stpcpy (mkfilename, "Makefile.");
- if (temp != NULL)
- *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';