~mathiaz/ubuntu/lucid/mysql-dfsg-5.1/zap-bug-552053

« back to all changes in this revision

Viewing changes to cmd-line-utils/libedit/np/strlcpy.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (1.1.2 upstream) (0.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090625125545-m8ogs96zzsri74xe
Tags: 5.1.34-1ubuntu1
* Merge from debian experimental (and 5.0 from main), remaining changes:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.
  - debian/control:
    + Make libmysqlclient16-dev a transitional package depending on
      libmysqlclient-dev.
    + Make libmysqlclient-dev conflict with libmysqlclient15-dev.
    + Don't build mysql-server, mysql-client, mysql-common and
      libmysqlclient15-dev binary packages since they're still provided
      by mysql-dfsg-5.0.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
    + install mysql-test and sql-bench to /usr/share/mysql/ rather than
      /usr/.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.0.files: install apparmor profile.
    - debian/mysql-server-5.0.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.0.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.0.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
  - Don't package sql-bench and mysql-test file.
* Dropped changes:
  - debian/patches/92_ssl_test_cert.dpatch: certificate expiration in
    test suite (LP: #323755). Included upstream.
* Dropped from 5.0:
  - apparmor profile:
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6. All version
      of apparmor-profile (>hardy) are higher than this version.
    - debian/mysql-server-5.0.preinst: create symlink for force-complain/
      on pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where the profile
      doesn't exist. Support for pre-hardy upgrades is no longer needed.
* debian/mysql-server-5.1.postinst: fix debian-sys-maint user creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*      $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $     */
 
1
/*      $NetBSD: strlcpy.c,v 1.3 2007/06/04 18:19:27 christos Exp $     */
 
2
/*      $OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $     */
2
3
 
3
4
/*
4
5
 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
5
 
 * All rights reserved.
6
 
 *
7
 
 * Redistribution and use in source and binary forms, with or without
8
 
 * modification, are permitted provided that the following conditions
9
 
 * are met:
10
 
 * 1. Redistributions of source code must retain the above copyright
11
 
 *    notice, this list of conditions and the following disclaimer.
12
 
 * 2. Redistributions in binary form must reproduce the above copyright
13
 
 *    notice, this list of conditions and the following disclaimer in the
14
 
 *    documentation and/or other materials provided with the distribution.
15
 
 * 3. The name of the author may not be used to endorse or promote products
16
 
 *    derived from this software without specific prior written permission.
17
 
 *
18
 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
 
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
 
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
21
 
 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
 
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24
 
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25
 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26
 
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27
 
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
6
 *
 
7
 * Permission to use, copy, modify, and distribute this software for any
 
8
 * purpose with or without fee is hereby granted, provided that the above
 
9
 * copyright notice and this permission notice appear in all copies.
 
10
 *
 
11
 * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL
 
12
 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
 
13
 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE
 
14
 * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
15
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 
16
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 
17
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28
18
 */
29
19
 
 
20
#if !defined(_KERNEL) && !defined(_STANDALONE)
 
21
#if HAVE_NBTOOL_CONFIG_H
 
22
#include "nbtool_config.h"
 
23
#else
30
24
#include "config.h"
 
25
#endif
31
26
#if defined(LIBC_SCCS) && !defined(lint)
32
 
#if 0
33
 
static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $";
34
 
#endif
35
27
#endif /* LIBC_SCCS and not lint */
36
 
#ifndef lint
37
 
static const char rcsid[] =
38
 
  "$FreeBSD: src/lib/libc/string/strlcpy.c,v 1.2.4.1 2001/07/09 23:30:06 obrien Exp $";
 
28
 
 
29
#ifdef _LIBC
 
30
#include "namespace.h"
39
31
#endif
40
 
 
41
32
#include <sys/types.h>
 
33
#include <assert.h>
42
34
#include <string.h>
43
35
 
 
36
#ifdef _LIBC
 
37
# ifdef __weak_alias
 
38
__weak_alias(strlcpy, _strlcpy)
 
39
# endif
 
40
#endif
 
41
#else
 
42
#include <lib/libkern/libkern.h>
 
43
#endif /* !_KERNEL && !_STANDALONE */
 
44
 
 
45
 
 
46
#if !HAVE_STRLCPY
44
47
/*
45
48
 * Copy src to string dst of size siz.  At most siz-1 characters
46
49
 * will be copied.  Always NUL terminates (unless siz == 0).
47
50
 * Returns strlen(src); if retval >= siz, truncation occurred.
48
51
 */
49
 
size_t strlcpy(dst, src, siz)
50
 
        char *dst;
51
 
        const char *src;
52
 
        size_t siz;
 
52
size_t
 
53
strlcpy(char *dst, const char *src, size_t siz)
53
54
{
54
 
        register char *d = dst;
55
 
        register const char *s = src;
56
 
        register size_t n = siz;
 
55
        char *d = dst;
 
56
        const char *s = src;
 
57
        size_t n = siz;
 
58
 
 
59
        _DIAGASSERT(dst != NULL);
 
60
        _DIAGASSERT(src != NULL);
57
61
 
58
62
        /* Copy as many bytes as will fit */
59
63
        if (n != 0 && --n != 0) {
73
77
 
74
78
        return(s - src - 1);    /* count does not include NUL */
75
79
}
 
80
#endif