mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kari Hurtta <hurtta@leija.mh.fmi.fi>
To: "Peter Wächtler" <pwaechtler@loewe-komp.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [off topic?] Re: [PATCH] strtok --> strsep in framebuffer drivers (part 2)
Date: Sat, 27 Oct 2001 10:00:10 +0300 (EEST)	[thread overview]
Message-ID: <200110270700.f9R70AkT028190@leija.fmi.fi> (raw)
In-Reply-To: <3BD8154E.24511282@loewe-komp.de>

> René Scharfe wrote:

> NAME
>        strsep - extract token from string
> [...]
> RETURN VALUE
>        The strsep() function returns a pointer to the  token,  or
>        NULL if delim is not found in stringp.
> 
> If strsep returns NULL, and you dereference it -> Oops.
> 
> 
> ! if (!this_opt)
> 	continue;

Is that manual page incorrect?

I would think that 

	strsep() returns NULL  when *stringp points to '\0' character
	
	and that if delim is not found in stringp then stringp
	is just advanced to '\0' character of string (and original
	*stringp value is returned)

If that is not true, then these all patches are incorrect.
Namely last token will be skipped.

-- 
          /"\                           |  Kari 
          \ /     ASCII Ribbon Campaign |    Hurtta
           X      Against HTML Mail     |
          / \                           |

  reply	other threads:[~2001-10-27  7:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-24 23:22 René Scharfe
2001-10-25 13:36 ` Peter Wächtler
2001-10-27  7:00   ` Kari Hurtta [this message]
2001-10-27  7:55     ` [off topic?] " Kari Hurtta
2001-10-29  5:34       ` Guest section DW
2001-10-29  7:12         ` Kari Hurtta
2001-10-29 14:07           ` Guest section DW

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200110270700.f9R70AkT028190@leija.fmi.fi \
    --to=hurtta@leija.mh.fmi.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pwaechtler@loewe-komp.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®