summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-08-15 21:47:29 +0000
committerMike Frysinger <vapier@gentoo.org>2013-08-15 21:47:29 +0000
commit4475916996f17b01a65106553b1a8bab71f2f5cb (patch)
treec35dcd57792a4e477bdb43899f684b3f5e0e7204 /sys-power/nvclock
parentFix file collisions wrt bug #481106. (diff)
downloadhistorical-4475916996f17b01a65106553b1a8bab71f2f5cb.tar.gz
historical-4475916996f17b01a65106553b1a8bab71f2f5cb.tar.bz2
historical-4475916996f17b01a65106553b1a8bab71f2f5cb.zip
Fix gtk linkage against X libs. Respect $AR settings. Fix .desktop warnings. Fix buffers overflows in random messages #364667 by Diego Elio Pettenò.
Package-Manager: portage-2.2.0/cvs/Linux x86_64 Manifest-Sign-Key: 0xFB7C4156
Diffstat (limited to 'sys-power/nvclock')
-rw-r--r--sys-power/nvclock/ChangeLog14
-rw-r--r--sys-power/nvclock/Manifest31
-rw-r--r--sys-power/nvclock/files/nvclock-0.8_p20110102-buffers.patch202
-rw-r--r--sys-power/nvclock/files/nvclock-0.8_p20110102-desktop.patch18
-rw-r--r--sys-power/nvclock/files/nvclock-0.8_p20110102-r1-make.patch94
-rw-r--r--sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch6
-rw-r--r--sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild64
7 files changed, 417 insertions, 12 deletions
diff --git a/sys-power/nvclock/ChangeLog b/sys-power/nvclock/ChangeLog
index f74c25d789a2..abe82aedafe7 100644
--- a/sys-power/nvclock/ChangeLog
+++ b/sys-power/nvclock/ChangeLog
@@ -1,6 +1,16 @@
# ChangeLog for sys-power/nvclock
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-power/nvclock/ChangeLog,v 1.12 2012/09/05 08:12:47 jlec Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/nvclock/ChangeLog,v 1.13 2013/08/15 21:47:24 vapier Exp $
+
+*nvclock-0.8_p20110102-r2 (15 Aug 2013)
+
+ 15 Aug 2013; Mike Frysinger <vapier@gentoo.org>
+ +files/nvclock-0.8_p20110102-buffers.patch,
+ +files/nvclock-0.8_p20110102-desktop.patch,
+ +files/nvclock-0.8_p20110102-r1-make.patch, +nvclock-0.8_p20110102-r2.ebuild,
+ files/nvclock-0.8_p20110102-usleep.patch:
+ Fix gtk linkage against X libs. Respect $AR settings. Fix .desktop warnings.
+ Fix buffers overflows in random messages #364667 by Diego Elio Pettenò.
05 Sep 2012; Justin Lecher <jlec@gentoo.org> nvclock-0.8_beta4-r4.ebuild,
nvclock-0.8_p20110102-r1.ebuild:
diff --git a/sys-power/nvclock/Manifest b/sys-power/nvclock/Manifest
index 4cce058c33ff..d7c1490e878c 100644
--- a/sys-power/nvclock/Manifest
+++ b/sys-power/nvclock/Manifest
@@ -4,21 +4,34 @@ Hash: SHA256
AUX nvclock-0.8_beta4-as-needed.patch 552 SHA256 3aa0b03fa8bbb0ef3d4266d0d26d9049554b3e4b499f31ab17a1f7b0974fc90b SHA512 641eb52a797c0687d54256c21b0b6c4bf0dc23c716185de5756626c9f55200d5b05dcf3b1d4d7bbc1d036b4487d33eeb76e6b4db010cc06754bf93d242f8a6d5 WHIRLPOOL 34a26e481ec422cc3db0deea7cb63505069dbac379a96a27a6b74bbe9ec864ae22f47d7311d2943498f6c7861be7cd8ad30d27933269e4444e0c277fe6f71651
AUX nvclock-0.8_beta4-flags.patch 3346 SHA256 94e847927cf6c7fe662ef9b03455d690fca9b18f82ae624af13d64a1fcd3797a SHA512 3c0119e457bffd5e8e71f98c9f36949a8efa6ae7962089031a4ba05179e9b1fd3133f1badbe8808c450096ea46665384018010a4b592547a8eede7f162aab2a2 WHIRLPOOL e669dfd0c915a793aad5b368bad2ae06e1ab3439f90d59d1dc8e60dd418047530dbef9b56c68a4881a45f199ac6d47cab7f8a687bd5cde49c6e3b8eebfdac417
AUX nvclock-0.8_beta4-headers.patch 1280 SHA256 a095d7741a6c1e7cf812a56be97ec94debc263e1d8aa2f6bbd51643bebf02cbc SHA512 0d69b3c7efbe575c45e25ebff8a35e25c6847bb4910d1f589ff4e369bddbe2778143f720bf6fb5671b9485d44d67108976076a033f052bcb535ec9ae9049877d WHIRLPOOL f732174ff6cebe7fb3aef72b2ebc76853cecb0c64a868e361c0e833870d7751c6247afc994975694ac4ff07d4cd5d3df885d752ba2ae897d9bf673a351f941de
+AUX nvclock-0.8_p20110102-buffers.patch 5181 SHA256 aecb2ecc04601dcd941fb60e83190b3b4e4b8ab656c35788d57baf1cbad95d34 SHA512 bca744826c3b3d12e4e694d692d58cc6b1004c6198ea65af765dacce717e523e0ae4f48fc7b95cadd377160e4c41a311ca901c0a269d0781705fb25ce2919924 WHIRLPOOL ef200a59c2fba56e78f2dd1b02d61bf1aa4bb8e1dd47130bc1eb86c0fb3e68762e5391e60b51062b848efc71aea0a9a35c024c87fbf28418834a7bd3c705b5a1
+AUX nvclock-0.8_p20110102-desktop.patch 544 SHA256 b1e91daa971459d9719a44f0a392044919fd1034ea85a81c8088571f9896ccb0 SHA512 4816780a6fc1770853d547de3f4e7b1533086b69ac380e99df47ba23dff696f1bd9644de9fac25ed82cb86284f2af28323245249d9372a6064499cdfc84618c2 WHIRLPOOL c890094e0ecdb87c1a824e159ea2b0dfe60f119d1091c8ada4b63e72dfba4b26762c69e55921622edcb4364138dc103e7384788db414113118bae7aa1c61bbfd
AUX nvclock-0.8_p20110102-make.patch 3012 SHA256 00ec1d8658218879bf5d7e7a7cd868682f977586812e1a0ef84efd81202dd266 SHA512 4072cbde72b715bd05cc06e8c1a2e0e99bca9d6991e5f6d94c41dcee0f622bb4b639148e0dfd5c5af86b9fc5ab60d9c0e1c3b4eb719f2ffe81e7ed7ad9f622b8 WHIRLPOOL e38f0749f89f0620d139faddc4a38259b13612eefe2d8c670c2ebb07bb2d40633f2783966b01bf287d0245a12b7a22721d26ccf3afd6ed6fac69a7d42bbb1803
-AUX nvclock-0.8_p20110102-usleep.patch 192 SHA256 38e3ecea7770036307c14a24b8d71412f03edc7b5aca6ae49b4a2db296d0dd01 SHA512 7c707238217d13a7f1dc408c7d31fc0834b63c06c5061acac984ac3a13cd411a5496cc351b3386485ade07c131360666645c33c370662d4c896e661045146963 WHIRLPOOL 7ea988bca841e8d172225d38e4c4140ae82fbbbe48b29af3455bdb8acd7c9d3ed0f301843133a97a53295bf22516b16752c7306f119953c67a2494e324ab4874
+AUX nvclock-0.8_p20110102-r1-make.patch 2788 SHA256 b9e3345d5163e5e207477028f7cf07da3aa91d018124c9ccbac2cfae5171c7d0 SHA512 fa1b6591efd950d90501a72ecd1232fdac878cd6126eb15528526a90f4b99c7fe4348a6382a0c111b5af849f678b0a59b143a8ea74653e6d78114887c632a0a6 WHIRLPOOL 792de5a1837ceb9b913375bf4da47a918e5525f4cbf7928ad82a4eb60196f7106d85f15ee72e59f08d9a2a662fb3109f5be5c8524adda6f2174d63988ea4958b
+AUX nvclock-0.8_p20110102-usleep.patch 295 SHA256 4c7b942abc0679a3b45b1c355a00ebd1d8ef1f469c7dcdb2e454daedef029eef SHA512 6681f08788d79b0534734cc09fef5df3686c5fe6664f5e7bd634ee8e45a3e49821201895f221cd42e7cab2be88330febd57f069a24e09da4c60ef2b1fd6ee206 WHIRLPOOL 82545c5bca32ea19e3f5f8100d9401a2e6d5f08e24880cf12f497b09768371a6f1238891587a38f66d2cee6982a1b23bd12db0ec846ebf8350c7e788bbf551e4
AUX nvclock_confd 360 SHA256 2bbf36faa3b78425471275f70c4d8abdff4720dc854152e4ad7b2da68810bdca SHA512 9a5ebc91fe1346677b982d178099d577ad285b104c38720a975fc6b25190ec86e00ffbc165e7409b8aba5d8d9c1d336508579deb573c5ba7495b84fa28900519 WHIRLPOOL d1f80835454b52e9afa8fcdc96dd9e4b04401124669257c562d3eb3ecb5da446e55ecaa78076fc828c08a36c7f7407ddeeb8633aae86fd2669263cdd9c45189e
AUX nvclock_initd 144 SHA256 5db21835535d48564417a58a92a646c0f5b8e672779978892094556b7650c140 SHA512 98f87a9208fd3b771f9a47bb857c02826672522b14c811ddc1bb2098f083c5a643aa9103c66fea0c340558cc95177b7fbba3a5c0a8cd80fd9c0406be77efde3f WHIRLPOOL 87679e231c27fae46611f6a650935fce0b89202f86cf1a807316360c058f1c128e1108ebc92e8f16c7552e2b27c8acfad3304834b2d373f2a9f1997bddfc5235
-DIST nvclock-0.8_p20110102.tar.bz2 285043 SHA256 d2a753908ef665caa996b71efd3081501e4b0fb45fa827add685cbc85d5d3745
-DIST nvclock0.8b4.tar.gz 336999 SHA256 bdb695e869822c4740c361bcace81b5527b774002d42785c986da9a92d7a9b0b
+DIST nvclock-0.8_p20110102.tar.bz2 285043 SHA256 d2a753908ef665caa996b71efd3081501e4b0fb45fa827add685cbc85d5d3745 SHA512 01bf7faed83acdf2390e1f410b2f8b697ff647b15562a6960a99666ec5121b532cbf4380137c9ee24221ccafff641bcdef4748dcad7ac92fb25fa15e735dd140 WHIRLPOOL e0d42a293add54b2d74e94fb54e0b20d29041b741476c63dc29a28ce10efc717a68d7bc82f4fb38f57a998526db4510d0b419e2617261765c8b38bb45ba24c43
+DIST nvclock0.8b4.tar.gz 336999 SHA256 bdb695e869822c4740c361bcace81b5527b774002d42785c986da9a92d7a9b0b SHA512 1d35f29b800a6c89960d997d954629b30747c235c311423cf21865000c214d1728b612baf8220ae0184f9358df27ea65f236a32de987ec4a73eab6867d6b3c37 WHIRLPOOL 918892b980c52bb6194ff13acd8e2e74b54ca7efa59b5cf8b87c7c34716fe3d6a27dfaf8b5670e0620e3b32c843ab78d86f17c6f18068fbc439d160e4bafd148
EBUILD nvclock-0.8_beta4-r4.ebuild 1653 SHA256 fa638a7e9f822f7f34d07f766fa33ca28630dff8c524f0ca12f7c3b3f6396028 SHA512 98f6ba48991ffb1e1558660e908ec696fbca9a7a495e7d283d02887a6f741b86c19ba494c205403ca30377d941d5301ca2dd4c280a9e3507ff778d30d6700027 WHIRLPOOL 6415ec2f2b0de3f467ac352825fb6aea4fa47e2c5c30000f3e9e112223f91ad5c03b31ae9659d56788a1af96b9c677cabeef15070666bc0aaa5d952710b20aa8
EBUILD nvclock-0.8_p20110102-r1.ebuild 1521 SHA256 9485a0946c7fb238c67b3df10c1e52e5b388e601285baf1c2ef46a716d766773 SHA512 0b0963b0d111c7933235dcf1e2235041aedc217cebd5505a59b58033955efa2d205f4567f051c9f9cabadfaf4e613e230060d8b12545b05dc3b01e1fae076bc0 WHIRLPOOL 4af4e03caa4b2a75de287a52f12486b61945ff3efb89a458a3902b3d7cd8a5ef8790bb597d4a630e425e699d7801ad9d8447dbd6d3acb50a3012ca195683cef5
-MISC ChangeLog 9115 SHA256 8b7580296f06a68feaa0ae4229fb148292634af166063c20c9d74054f14c43ca SHA512 c5db8c86a069416a9fcb8c972415e49d960e3d6523a2ae6e7867eebee4a08562f644f8efb6cf65e702c920021cfec15ba9418f7663a704647e9faccc3aecfc42 WHIRLPOOL fafe5bc3b022830c62d75bfdeff2c8779ab54e2363d6f35b6c854df1186b37c0f290c69ab6c716645b9c3a75d64b4f07c5b35991cd69b597ad83329eba9c781a
+EBUILD nvclock-0.8_p20110102-r2.ebuild 1391 SHA256 c5c012772131003a950c02309508eb9592184adb68a26192e6ea45dc071474f6 SHA512 8cf3359236233cb5cd9e12d5aebc51ddaee72a5c8721ffbe1921a669b4a36361ad8cebc8cc36d939f588dbcdd26b108878e144a1d92bbd73f69058c1fcdd211b WHIRLPOOL d68dbfb04eae750d284b06646de33e389f6c3f78443c55977ecfe0af66edd39cac7a8a2236e249930ba89e2c20ee6989c1674cf6af93cedcc09bc1ae4466ab6e
+MISC ChangeLog 9581 SHA256 8da5043583e420ef2cd413abfb280759de462bbfc3b2813b025059c19c7bc48a SHA512 e32cc4f489950f00df492682929e64eee7f2be1c5adc193591950252139a1425b4aa16058b85fb2f1746d0674bbd6f6eadeaea0b7072b0c8463aedaef6211c24 WHIRLPOOL deb005ed49cd7ea911a1a331d4a9c6e5d731d315fedc9d152919bd63bdbac3ecc3ef98f6bf4ce1a41d04d6f7d25f77694ffc54e3135608be257b47a9375cf3a7
MISC metadata.xml 387 SHA256 7c2decd917f7c4a4d86ca0d14075647a2b66ebf69b357865ff6c7d14abf8ef44 SHA512 83b2dd8fb88cda55a0477ae491f0af989845ac1415ac885a3eff667f09204a4f8bdb919be6ec049a53d09ab7c310cbfb2bd690fa1b5eea2714b02e6addaf7322 WHIRLPOOL 0c32621ce4d70b5c7e051c0536ae51e4fd6acbee5be9581239f9267cb93ff6397c274d52dfea202c1a2a25734cab3ba65bdaf8ccc6ffdf74b53b5dd556a133d1
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.19 (GNU/Linux)
-Comment: GPGTools - http://gpgtools.org
+Version: GnuPG v2.0.20 (GNU/Linux)
-iEYEAREIAAYFAlBHCYAACgkQgAnW8HDreRaMhgCg0jeHZdDIN9JiPtTgTF6p5fQc
-vzEAnjWKiOPCf4LUvEJ6ITTEOrqJSd+K
-=L3Zx
+iQIcBAEBCAAGBQJSDUxyAAoJELEHsLL7fEFWinMQAK+NLvJx28jngc5lyhIMI3WT
+CT63Mb9fg17ACdYYM+y0gUYd2AhOnj7QbN2acL7vydxYWjj1Ccd6Sxrt/L/MBRbQ
+o/cHLpIPWCGouam1qS5teecm7rK2GObg5d1ciEydoKpX93rFnyySh8nuFPbScuA0
+FFBzdBw9kv9B+s9cylnnlELB+CSpeg30LvWbllI2KozvD6pisd5ZrG0L54UJLovx
+w3GeqZbYZxJaLQezTSIVERKMKIcMPSWKbh5tNhzOD0J32Z8+MDbB91p1ftFS/HRZ
+eqaeA3QV9FkjkZlZoewCepcf8RL/+aX1XxkmpcRTEG88N0tWgy3NGlOr0rFxA4wz
+ZTaosVevb3pNu5hZ0/nT/NYthb8SrK9AhH7j3NxafgwczYam0ZjZ36Ea4nHfHp/8
+4lw0Vr2h9PHC1392tusQkzh59Db6fn90DPGlAGa/TLwfwgdNv12N46ZrsYW4Zc6q
+c1pb1ENZP6ukI2kZ8jpno6981WopA2U9PrmCYIInlQ2SGwuwPhLPS1OX+E/Eds4e
+g6HQtSx5zXFU2+CPtCesoUWQEursAWtMfAk2Z+Mlm5Gk5bu7i59El99BVQRUwMeq
+3IpFqw0OkUovQhGVJFDXBCQpOLnIcT9hpeykLCTvurfUUe6YPupE6whKfprqVOtV
+24Mib+hV44MHRaPWsjKl
+=Apsg
-----END PGP SIGNATURE-----
diff --git a/sys-power/nvclock/files/nvclock-0.8_p20110102-buffers.patch b/sys-power/nvclock/files/nvclock-0.8_p20110102-buffers.patch
new file mode 100644
index 000000000000..f64cb9b8456d
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock-0.8_p20110102-buffers.patch
@@ -0,0 +1,202 @@
+https://bugs.gentoo.org/364667
+
+clean up random buffer overflows in the code
+
+--- a/src/backend/back_linux.c
++++ b/src/backend/back_linux.c
+@@ -42,7 +42,9 @@ static int probe_devices();
+ static int check_driver()
+ {
+ FILE *proc;
+- char buffer[80];
++ char *buffer = NULL;
++ size_t len;
++ int ret = 0;
+
+ proc = fopen("/proc/modules", "r");
+
+@@ -50,9 +52,9 @@ static int check_driver()
+ if(proc == NULL)
+ return 0;
+
+- while(fgets(buffer, 80, proc) != NULL)
++ while(getline(&buffer, &len, proc) != -1)
+ {
+- char name[80];
++ char name[100];
+ int size;
+ int used;
+
+@@ -64,26 +66,23 @@ static int check_driver()
+ {
+ if(strcmp(name, "NVdriver") == 0)
+ {
+- fclose(proc);
+ if(used)
+- return 1;
+-
+- return 0;
++ ret = 1;
++ break;
+ }
+
+ if(strcmp(name, "nvidia") == 0)
+ {
+- fclose(proc);
+ if(used)
+- return 2;
+-
+- return 0;
++ ret = 2;
++ break;
+ }
+ }
+ }
++ free(buffer);
+ fclose(proc);
+
+- return 0;
++ return ret;
+ }
+
+ int init_nvclock()
+@@ -114,7 +113,8 @@ static int probe_devices()
+ {
+ int dev, irq, reg_addr, i=0;
+ unsigned short devbusfn;
+- char buf[256];
++ char *buf = NULL;
++ size_t len;
+ FILE *proc;
+
+ proc = fopen("/proc/bus/pci/devices", "r");
+@@ -124,7 +124,7 @@ static int probe_devices()
+ return 0;
+ }
+
+- while(fgets(buf, sizeof(buf)-1, proc))
++ while(getline(&buf, &len, proc) != -1)
+ {
+ if(sscanf(buf,"%hx %x %x %x",&devbusfn, &dev, &irq, &reg_addr) != 4) continue;
+
+@@ -181,6 +181,7 @@ static int probe_devices()
+ i++;
+ }
+ }
++ free(buf);
+ fclose(proc);
+
+ if(i==0)
+--- a/src/backend/config.c
++++ b/src/backend/config.c
+@@ -286,8 +286,9 @@ int open_config()
+ {
+ if(mkdir(nvclock.path, 0755))
+ {
+- char buf[80];
+- sprintf(buf, "Can't create '%s'. Do you have sufficient permissions?\n", nvclock.path);
++ char buf[1024];
++ snprintf(buf, sizeof(buf), "Can't create path (do you have sufficient permissions?): %s", nvclock.path);
++ buf[sizeof(buf) - 1] = '\0';
+ set_error_str(buf);
+ return 0;
+ }
+@@ -297,8 +298,9 @@ int open_config()
+ /* Check if .nvclock really is a directory. For some users it was a file and this led to a segfault. */
+ if(!S_ISDIR(stat_buf.st_mode))
+ {
+- char buf[80];
+- sprintf(buf, "Can't open '%s'. Is it really a directory?\n", nvclock.path);
++ char buf[1024];
++ snprintf(buf, sizeof(buf), "Can't open path (Is it really a directory?): %s", nvclock.path);
++ buf[sizeof(buf) - 1] = '\0';
+ set_error_str(buf);
+ return 0;
+ }
+--- a/src/backend/error.c
++++ b/src/backend/error.c
+@@ -41,23 +41,19 @@ void set_error_str(const char *str)
+ }
+
+
+-char *get_error(char *buf, int size)
++const char *get_error(void)
+ {
+ switch(nvclock.nv_errno)
+ {
+ case NV_ERR_NO_DEVICES_FOUND:
+- strcpy(buf, "No nvidia cards found in your system!");
+- break;
++ return "No nvidia cards found in your system!";
+ case NV_ERR_NO_DRIVERS_FOUND:
+- strcpy(buf, "You don't have enough permissions to run NVClock! Retry as root or install the Nvidia drivers.");
+- break;
++ return "You don't have enough permissions to run NVClock! Retry as root or install the Nvidia drivers.";
+ case NV_ERR_NOT_ENOUGH_PERMISSIONS:
+- strcpy(buf, "You don't have enough permissions to run NVClock! Retry as root.");
+- break;
++ return "You don't have enough permissions to run NVClock! Retry as root.";
+ case NV_ERR_OTHER:
+- strcpy(buf, nvclock.nv_err_str);
+- break;
++ return nvclock.nv_err_str;
+ }
+
+- return buf;
++ return "unknown";
+ }
+--- a/src/backend/nvclock.h
++++ b/src/backend/nvclock.h
+@@ -335,7 +335,7 @@ cfg_entry* lookup_entry(cfg_entry **cfg, char *section, char *name);
+ void destroy(cfg_entry **cfg);
+
+ /* error handling */
+-char *get_error(char *buf, int size);
++const char *get_error(void);
+ void set_error(int code);
+ void set_error_str(const char *err);
+
+--- a/src/gtk/main.c
++++ b/src/gtk/main.c
+@@ -264,8 +264,7 @@ int main (int argc, char *argv[])
+ */
+ if(!init_nvclock())
+ {
+- char buf[80];
+- GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", get_error(buf, 80));
++ GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", get_error());
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ g_signal_connect_swapped(GTK_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog));
+ gtk_widget_destroy(dialog);
+--- a/src/nvclock.c
++++ b/src/nvclock.c
+@@ -604,8 +604,7 @@ int main(int argc, char *argv[])
+
+ if(!init_nvclock())
+ {
+- char buf[80];
+- fprintf(stderr, "Error: %s\n", get_error(buf, 80));
++ fprintf(stderr, "Error: %s\n", get_error());
+ return 0;
+ }
+
+@@ -851,8 +850,7 @@ int main(int argc, char *argv[])
+ {
+ if(!set_card(i))
+ {
+- char buf[80];
+- fprintf(stderr, "Error: %s\n", get_error(buf, 80));
++ fprintf(stderr, "Error: %s\n", get_error());
+ return 0;
+ }
+
+@@ -887,8 +885,7 @@ int main(int argc, char *argv[])
+ /* set the card object to the requested card */
+ if(!set_card(card_number))
+ {
+- char buf[80];
+- fprintf(stderr, "Error: %s\n", get_error(buf, 80));
++ fprintf(stderr, "Error: %s\n", get_error());
+ return 0;
+ }
+
diff --git a/sys-power/nvclock/files/nvclock-0.8_p20110102-desktop.patch b/sys-power/nvclock/files/nvclock-0.8_p20110102-desktop.patch
new file mode 100644
index 000000000000..034208ff817a
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock-0.8_p20110102-desktop.patch
@@ -0,0 +1,18 @@
+fix qa warning:
+
+/usr/share/applications/nvclock.desktop: error: (will be fatal in the future):
+value "nvclock.png" for key "Icon" in group "Desktop Entry" is an icon name
+with an extension, but there should be no extension as described in the Icon
+Theme Specification if the value is not an absolute path
+
+--- a/nvclock.desktop
++++ b/nvclock.desktop
+@@ -3,7 +3,7 @@ Encoding=UTF-8
+ Name=NVCLOCK
+ Comment=Overclock and Monitor NVIDIA cards
+ Exec=nvclock_gtk
+-Icon=nvclock.png
++Icon=nvclock
+ Terminal=false
+ Type=Application
+ Categories=System;
diff --git a/sys-power/nvclock/files/nvclock-0.8_p20110102-r1-make.patch b/sys-power/nvclock/files/nvclock-0.8_p20110102-r1-make.patch
new file mode 100644
index 000000000000..e45e2a6aa341
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock-0.8_p20110102-r1-make.patch
@@ -0,0 +1,94 @@
+- Fix building with --as-needed
+- Fix parallel make by defining two new targets
+- Fix one spelling error
+- Respect CFLAGS, LDFLAGS
+- Link GTK frontend against -lX11 since it uses XOpenDisplay all the time
+
+--- a/configure.in
++++ b/configure.in
+@@ -141,7 +141,7 @@
+ if [test "$HAVE_NVCONTROL" = "yes"]; then
+ echo "- NV-CONTROL support enabled"
+ else
+- echo "- NV-CONROL support disabled"
++ echo "- NV-CONTROL support disabled"
+ fi
+ if [test "$HAVE_GTK2" = "yes"]; then
+ echo "- GTK2 GUI enabled"
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -16,7 +16,7 @@
+ ifeq ($(HAVE_NVCONTROL), yes)
+ DEPS=$(libbackend) $(libnvcontrol)
+ INCLUDES=@X11_CFLAGS@ -I./backend -I./nvcontrol -I..
+- LIBS=@X11_LIBS@ -L./backend -lbackend -L./nvcontrol -lnvcontrol
++ LIBS=-L./backend -lbackend -L./nvcontrol -lnvcontrol @X11_LIBS@
+ else
+ DEPS=$(libbackend)
+ INCLUDES=-I./backend -I./nvcontrol -I..
+@@ -30,12 +30,17 @@
+
+ all: all-recursive nvclock smartdimmer
+
++$(libbackend):
++ $(MAKE) -C backend
++
++$(libnvcontrol):
++ $(MAKE) -C nvcontrol
+
+ nvclock: $(DEPS) $(LIB) nvclock.c
+- $(CC) $(CFLAGS) -o nvclock $(nvclock_SOURCES) $(INCLUDES) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o nvclock $(nvclock_SOURCES) $(INCLUDES) $(LIBS)
+
+ smartdimmer: $(DEPS) $(LIB) smartdimmer.c
+- $(CC) $(CFLAGS) -o smartdimmer $(smartdimmer_SOURCES) $(INCLUDES) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o smartdimmer $(smartdimmer_SOURCES) $(INCLUDES) $(LIBS)
+
+
+ clean: clean-recursive clean-app
+--- a/src/gtk/Makefile.in
++++ b/src/gtk/Makefile.in
+@@ -27,6 +27,7 @@
+ LIBS=@GTK_LIBS@ -L../backend -lbackend
+ OBJECTS=banner.o hw.o main.o settings.o
+ endif
++LIBS += -lX11
+
+
+ .PHONY: clean distclean install
+@@ -33,7 +33,7 @@
+ all: $(PROGRAM)
+
+ nvclock_gtk: $(DEPS) $(OBJECTS)
+- $(CC) $(CFLAGS) -o nvclock_gtk $(OBJECTS) $(libbackend) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o nvclock_gtk $(OBJECTS) $(libbackend) $(LIBS)
+
+ clean:
+ rm -f nvclock_gtk *.core *.o *.exe
+--- a/src/qt/Makefile.in
++++ b/src/qt/Makefile.in
+@@ -31,7 +31,7 @@
+ all: $(PROGRAM)
+
+ nvclock_qt: $(DEPS) qt_nvclock.moc qt_xfree.moc $(OBJECTS)
+- $(CXX) $(CXXFLAGS) -o nvclock_qt $(CXXFLAGS) $(OBJECTS) $(LIBS)
++ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o nvclock_qt $(OBJECTS) $(LIBS)
+
+ clean:
+ rm -f nvclock_qt *.core *.moc *.o
+--- a/src/backend/Makefile.in
++++ b/src/backend/Makefile.in
+@@ -1,11 +1,11 @@
+-CC=@CC@ -O0
++CC=@CC@
+ AR=ar
+ RANLIB=@RANLIB@
+
+ system=@system@
+ HAVE_NVCONTROL=@HAVE_NVCONTROL@
+ OBJECTS=backend.o bios.o config.o error.o nv30.o nv40.o nv50.o info.o overclock.o utils.o i2c.o xf86i2c.o adt7473.o f75375.o lm99.o w83781d.o w83l785r.o libc_wrapper.o
+-CFLAGS=@X11_CFLAGS@ -I../.. -I../nvcontrol
++CFLAGS=@CFLAGS@ @X11_CFLAGS@ -I../.. -I../nvcontrol
+
+ ifeq ($(system), FreeBSD)
+ OBJECTS+=back_bsd.o
diff --git a/sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch b/sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch
index 4391ee79ff83..93c3f288864b 100644
--- a/sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch
+++ b/sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch
@@ -1,7 +1,11 @@
+fix warning:
+libc_wrapper.c:54: warning: implicit declaration of function usleep
+
--- a/src/backend/libc_wrapper.c
+++ b/src/backend/libc_wrapper.c
-@@ -27,6 +27,7 @@
+@@ -27,6 +27,8 @@
++#define _BSD_SOURCE
#include <stdio.h>
#include "xfree.h"
+#include "config.h"
diff --git a/sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild b/sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild
new file mode 100644
index 000000000000..9dc29dd2fdef
--- /dev/null
+++ b/sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild,v 1.1 2013/08/15 21:47:24 vapier Exp $
+
+EAPI="4"
+
+inherit autotools eutils
+
+DESCRIPTION="NVIDIA Overclocking Utility"
+HOMEPAGE="http://www.linuxhardware.org/nvclock/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="gtk nvcontrol"
+
+RDEPEND="
+ gtk? (
+ x11-libs/gtk+:2
+ x11-libs/libX11
+ )
+ nvcontrol? ( x11-libs/libX11 x11-libs/libXext )
+"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-r1-make.patch \
+ "${FILESDIR}"/${P}-usleep.patch \
+ "${FILESDIR}"/${P}-desktop.patch \
+ "${FILESDIR}"/${P}-buffers.patch
+ eautoreconf
+}
+
+src_configure() {
+ sed -i \
+ -e "/^AR=ar/s:=.*:=$(tc-getAR):" \
+ src/*/Makefile.in || die
+
+ # Qt support would mean Qt 3.
+ econf \
+ --docdir=/usr/share/doc/${PF} \
+ --disable-qt \
+ $(use_enable gtk) \
+ $(use_enable nvcontrol)
+}
+
+src_compile() {
+ emake -C src/ nvclock smartdimmer
+ use gtk && emake -C src/gtk/
+}
+
+src_install() {
+ default
+
+ newinitd "${FILESDIR}"/nvclock_initd nvclock
+ newconfd "${FILESDIR}"/nvclock_confd nvclock
+}
+
+pkg_postinst() {
+ elog "To enable card overclocking at startup, edit your /etc/conf.d/nvclock"
+ elog "accordingly and then run: rc-update add nvclock default"
+}