From: Alexey Tourbin <at@altlinux.ru>
To: ALT Linux Sisyphus discussion list <sisyphus@altlinux.ru>
Subject: [sisyphus] Re: Пакет bluemote
Date: Tue, 7 Jun 2005 11:26:30 +0400
Message-ID: <20050607072630.GD5867@solemn.turbinal.org> (raw)
In-Reply-To: <42A3596E.2060908@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 656 bytes --]
On Sun, Jun 05, 2005 at 11:58:38PM +0400, Dmitry (Mothlike) Marochko wrote:
> char lockfile[MAXLEN];
>
> [...]
>
> int get_lock()
> {
> struct flock fl;
>
> strcpy(lockfile, getenv("HOME"));
> strcat(lockfile, BLUEMOTEDIR);
> strcat(lockfile, LOCKFILE);
Используйте asprintf.
char *lockfile = NULL;
char *home = getenv("HOME");
if (!home) {
// ...
exit(1);
}
if (asprintf(&lockfile, "%s/%s/%s", home, BLUEMOTEDIR, LOCKFILE) > 0) {
struct flock fl;
// ...
free(lockfile);
}
else {
perror("asprintf");
exit(1);
}
Существует портабельная реализация asprintf --
http://www.ijs.si/software/snprintf/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-06-07 7:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-05 19:58 [sisyphus] " Dmitry (Mothlike) Marochko
2005-06-05 20:37 ` Eugene Ostapets
2005-06-06 16:05 ` Dmitry (Mothlike) Marochko
2005-06-06 19:50 ` Boldin Pavel
2005-06-07 5:59 ` Epiphanov Sergei
2005-06-07 6:36 ` Epiphanov Sergei
2005-06-07 7:13 ` Andrei Bulava
2005-06-07 7:22 ` Epiphanov Sergei
2005-06-07 9:28 ` Andrey Rahmatullin
2005-06-09 16:20 ` Dmitry (Mothlike) Marochko
2005-06-13 6:32 ` [sisyphus] " Alexey Tourbin
2005-06-07 7:26 ` Alexey Tourbin [this message]
2005-06-07 7:36 ` Epiphanov Sergei
2005-06-07 7:43 ` Alexey I. Froloff
2005-06-07 8:16 ` Epiphanov Sergei
2005-06-07 9:38 ` Alexey Tourbin
2005-06-07 10:41 ` Epiphanov Sergei
2005-06-07 11:52 ` [sisyphus] asprintf(3) manpage? (was: Пакет bluemote) Alexey Tourbin
2005-06-07 12:37 ` Epiphanov Sergei
2005-06-07 15:32 ` Andrey Rahmatullin
2005-06-07 18:04 ` [sisyphus] Re: Пакет bluemote Dmitry (Mothlike) Marochko
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=20050607072630.GD5867@solemn.turbinal.org \
--to=at@altlinux.ru \
--cc=sisyphus@altlinux.ru \
/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
ALT Linux Sisyphus discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
public-inbox-index sisyphus
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sisyphus
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git