From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 7 Jun 2005 11:26:30 +0400 From: Alexey Tourbin To: ALT Linux Sisyphus discussion list Message-ID: <20050607072630.GD5867@solemn.turbinal.org> Mail-Followup-To: ALT Linux Sisyphus discussion list References: <42A3596E.2060908@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IOWfJl95iVQnrM9l" Content-Disposition: inline In-Reply-To: <42A3596E.2060908@gmail.com> Subject: [sisyphus] Re: =?koi8-r?b?8MHLxdQ=?= bluemote X-BeenThere: sisyphus@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Linux Sisyphus discussion list List-Id: ALT Linux Sisyphus discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2005 07:26:35 -0000 Archived-At: List-Archive: --IOWfJl95iVQnrM9l Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 05, 2005 at 11:58:38PM +0400, Dmitry (Mothlike) Marochko wrote: > char lockfile[MAXLEN]; >=20 > [...] >=20 > int get_lock() > { > struct flock fl; >=20 > strcpy(lockfile, getenv("HOME")); > strcat(lockfile, BLUEMOTEDIR); > strcat(lockfile, LOCKFILE); =E9=D3=D0=CF=CC=D8=DA=D5=CA=D4=C5 asprintf. char *lockfile =3D NULL; char *home =3D 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); } =F3=D5=DD=C5=D3=D4=D7=D5=C5=D4 =D0=CF=D2=D4=C1=C2=C5=CC=D8=CE=C1=D1 =D2=C5= =C1=CC=C9=DA=C1=C3=C9=D1 asprintf -- http://www.ijs.si/software/snprintf/ --IOWfJl95iVQnrM9l Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFCpUwmfBKgtDjnu0YRAssvAJ41syuMWs1ojLmkkpOTQGDT7MHNTQCeI2md KSjlsrALJd7nnVpLmCSc9nM= =UKP1 -----END PGP SIGNATURE----- --IOWfJl95iVQnrM9l--