From: Stanislav Ievlev <inger@altlinux.org>
To: sisyphus@altlinux.ru
Subject: Re: [sisyphus] u: xrcode-1.0-alt1, part II
Date: Thu, 29 May 2003 11:48:12 +0400
Message-ID: <20030529074812.GG23462@basalt.office.altlinux.org> (raw)
In-Reply-To: <20030528141536.GN18884@osdn.org.ua>
On Wed, May 28, 2003 at 05:15:36PM +0300, Michael Shigorin wrote:
> On Tue, May 27, 2003 at 02:05:33PM +0400, Dmitry V. Levin wrote:
> > > Это по принципу "так, а теперь кто отточил умение до автоматизма
> > > -- подскажите, что с _этим_ делать". Потому что в 22:46:00 меня,
> > > очевидно, более чем на прогулку по manpages не хватило.
>
> Уже сочинил примерно такое:
>
> - strcpy(temp, (char *) tmpnam(NULL));
> - else
> - strcpy(temp, argv[3]);
> - out = fopen(temp, "w");
> + out = mkstemp(temp);
> + else {
> + strncpy(temp, argv[3], sizeof(temp));
> + out = fopen(temp, "w");
> + }
Что-то тут совсем не то.
Зачем изобретать велосипед, не проще ли посмотреть в Сизифе.
Вот вариант который используется 99% программ:
{
+ int fd;
+ const char suffix[] = ".XXXXXX";
+ const char *tmp_dir = getenv("TMPDIR")?:"/tmp";
+ unsigned tmp_len = strlen( tmp_dir );
+ unsigned prog_len = strlen( __progname );
+ char tmpbuf[ tmp_len + prog_len + sizeof(suffix) + 1 ];
+
+ memcpy( tmpbuf, tmp_dir, tmp_len );
+ tmpbuf[ tmp_len ] = '/';
+ memcpy( tmpbuf + tmp_len + 1, __progname, prog_len );
+ memcpy( tmpbuf + tmp_len + prog_len + 1, suffix,
sizeof(suffix) );
+
+ fd = mkstemp(tmpbuf);
>
> По результатам собрал, проверил и сейчас залью "более другой"
> xrcode-1.0-alt1.
>
> > > Это раз. Два -- IMO это minor/major, но никак не block bug.
> > Любое использование tmpnam(3)&Co есть block bug, если только я
> > не сказал обратного.
>
> В docs, пожалуйста. Вместе с определением "&Co".
>
> > block - это значит, что доступ в дистрибутив закрыт.
>
> Я перестаю верить в эту шкалу. Почему -- уже высказал.
>
> > > Три -- если применять боцманские методы к достаточно
> > > contrib-пакетам, то я сейчас опять вспомню via686 >;-E
>
> --
> ---- WBR, Michael Shigorin <mike@altlinux.ru>
> ------ Linux.Kiev http://www.linux.kiev.ua/
prev parent reply other threads:[~2003-05-29 7:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-26 19:46 [sisyphus] u: xrcode-1.0-alt1 Michael Shigorin
2003-05-26 19:58 ` Dmitry V. Levin
2003-05-26 20:10 ` Yura Zotov
2003-05-27 9:48 ` [sisyphus] " Michael Shigorin
2003-05-27 10:05 ` Dmitry V. Levin
2003-05-27 10:14 ` Yura Zotov
2003-05-27 10:28 ` Dmitry V. Levin
2003-05-27 10:57 ` Yura Zotov
2003-05-29 7:45 ` Stanislav Ievlev
2003-05-29 8:45 ` Yura Zotov
2003-05-29 12:45 ` Stanislav Ievlev
2003-05-28 14:15 ` [sisyphus] u: xrcode-1.0-alt1, part II Michael Shigorin
2003-05-29 7:48 ` Stanislav Ievlev [this message]
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=20030529074812.GG23462@basalt.office.altlinux.org \
--to=inger@altlinux.org \
--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