diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 7d4f3f65e1c7..229da147255e 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -232,16 +232,16 @@ main(int argc, char *argv[]) char *pnextopt = NULL; char *val = ""; pass_flag_to_nmount = 1; - pval = strchr(opt, '='); pnextopt = strchr(opt, ','); + if (pnextopt != NULL) { + *pnextopt = '\0'; + pnextopt++; + } + pval = strchr(opt, '='); if (pval != NULL) { *pval = '\0'; val = pval + 1; } - if (pnextopt) { - *pnextopt = '\0'; - pnextopt++; - } if (strcmp(opt, "bg") == 0) { opflags |= BGRND; pass_flag_to_nmount=0;