NEWS.stable: log cherry-pick [e446f25]->[c092018] relocatable-shell: Update suggested...
[gnulib.git] / lib / strchrnul.c
index 0902c18..452b554 100644 (file)
@@ -1,5 +1,5 @@
 /* Searching in a string.
-   Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007-2014 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -37,6 +37,8 @@ strchrnul (const char *s, int c_in)
   unsigned char c;
 
   c = (unsigned char) c_in;
+  if (!c)
+    return rawmemchr (s, 0);
 
   /* Handle the first few bytes by reading one byte at a time.
      Do this until CHAR_PTR is aligned on a longword boundary.  */